Guest User

Untitled

a guest
Mar 7th, 2020
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.95 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace LegendaryFarming
  5. {
  6. class Program
  7. {
  8. // quantity material
  9. static void Main(string[] args)
  10. {
  11. Dictionary<string, int> legendaryItem = new Dictionary<string, int>();
  12. string items = Console.ReadLine();
  13. string[] materials = items.Split().ToArray();
  14. int value = 0;
  15. for (int i = 0; i < materials.Length; i++)
  16. {
  17. string currentValue = materials[i].ToLower();
  18. if (i % 2 == 0)
  19. {
  20. value = int.Parse(currentValue);
  21. }
  22. else
  23. {
  24. bool ItemExist = legendaryItem.ContainsKey(currentValue);
  25. if (ItemExist == true)
  26. {
  27. legendaryItem[currentValue] += value;
  28. }
  29. else
  30. {
  31. legendaryItem.Add(currentValue, value);
  32. }
  33. }
  34.  
  35. }
  36.  
  37. foreach (var item in legendaryItem)
  38. {
  39. if (item.Key == "fragments" && item.Value >= 250)
  40. {
  41. bool shardExist = false;
  42. bool motesExist = false;
  43. Console.WriteLine("Valanyr obtained!");
  44. Dictionary<string, int> legendaryShards = new Dictionary<string, int>();
  45. if (item.Value >= 250)
  46. {
  47. int fragments = item.Value - 250;
  48. legendaryShards.Add("fragments", fragments);
  49. }
  50. foreach (var item1 in legendaryItem)
  51. {
  52. if (item1.Key == "shards")
  53. {
  54. shardExist = true;
  55. legendaryShards.Add("shards", item1.Value);
  56. }
  57. else if (item1.Key == "motes")
  58. {
  59. motesExist = true;
  60. legendaryShards.Add("motes", item1.Value);
  61. }
  62. }
  63. if (shardExist == false)
  64. {
  65. legendaryShards.Add("shards", 0);
  66. }
  67. if (motesExist == false)
  68. {
  69. legendaryShards.Add("motes", 0);
  70. }
  71. foreach (var item2 in legendaryShards.OrderByDescending(p => p.Value).ThenBy(r=> r.Key))
  72. {
  73. Console.WriteLine($"{item2.Key} -> {item2.Value}");
  74. legendaryItem.Remove(item2.Key);
  75. }
  76. foreach (var item3 in legendaryItem.OrderBy(p => p.Key))
  77. {
  78. Console.WriteLine($"{item3.Key} -> {item3.Value}");
  79. }
  80.  
  81. }
  82.  
  83. else if (item.Key == "motes" && item.Value >= 250)
  84. {
  85. bool fragmentsExist = false;
  86. bool shardsExist = false;
  87. Console.WriteLine("Dragonwrath obtained!");
  88. Dictionary<string, int> legendaryShards = new Dictionary<string, int>();
  89. if (item.Value >= 250)
  90. {
  91. int motes = item.Value - 250;
  92. legendaryShards.Add("motes", motes);
  93. }
  94. foreach (var item1 in legendaryItem)
  95. {
  96. if (item1.Key == "shards")
  97. {
  98. shardsExist = true;
  99. legendaryShards.Add("shards", item1.Value);
  100. }
  101. else if (item1.Key == "fragments")
  102. {
  103. fragmentsExist = true;
  104. legendaryShards.Add("fragments", item1.Value);
  105. }
  106. }
  107. if (shardsExist == false)
  108. {
  109. legendaryShards.Add("shards", 0);
  110. }
  111. if(fragmentsExist == false)
  112. {
  113. legendaryShards.Add("fragments", 0);
  114. }
  115. foreach (var item2 in legendaryShards.OrderByDescending(p => p.Value).ThenBy(r => r.Key))
  116. {
  117. Console.WriteLine($"{item2.Key} -> {item2.Value}");
  118. legendaryItem.Remove(item2.Key);
  119. }
  120. foreach (var item3 in legendaryItem.OrderBy(p => p.Key))
  121. {
  122. Console.WriteLine($"{item3.Key} -> {item3.Value}");
  123. }
  124.  
  125.  
  126. }
  127. else if (item.Key == "shards" && item.Value >= 250)
  128. {
  129. bool fragmentsExist = false;
  130. bool motesExist = false;
  131. Console.WriteLine("Shadowmourne obtained!");
  132.  
  133. Dictionary<string, int> legendaryShards = new Dictionary<string, int>();
  134. if (item.Value >= 250)
  135. {
  136. int shards = item.Value - 250;
  137. legendaryShards.Add("shards", shards);
  138. }
  139. foreach (var item1 in legendaryItem)
  140. {
  141. if (item1.Key == "fragments")
  142. {
  143. fragmentsExist = true;
  144. legendaryShards.Add("fragments", item1.Value);
  145. }
  146. else if (item1.Key == "motes")
  147. {
  148. motesExist = true;
  149. legendaryShards.Add("fragments", item1.Value);
  150. }
  151. }
  152. if (motesExist == false)
  153. {
  154. legendaryShards.Add("motes", 0);
  155. }
  156. if (fragmentsExist == false)
  157. {
  158. legendaryShards.Add("fragments", 0);
  159. }
  160. foreach (var item2 in legendaryShards.OrderByDescending(p => p.Value).ThenBy(r => r.Key))
  161. {
  162. Console.WriteLine($"{item2.Key} -> {item2.Value}");
  163. legendaryItem.Remove(item2.Key);
  164. }
  165. foreach (var item3 in legendaryItem.OrderBy(p => p.Key))
  166. {
  167. Console.WriteLine($"{item3.Key} -> {item3.Value}");
  168. }
  169.  
  170. }
  171. }
  172. }
  173.  
  174. }
  175. }
Advertisement
Add Comment
Please, Sign In to add comment