Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Legendary_Farming
- {
- class Program
- {
- static void Main(string[] args)
- {
- var legendaryItemValue = new Dictionary<string, int>();
- legendaryItemValue.Add("shards", 0);
- legendaryItemValue.Add("fragments", 0);
- legendaryItemValue.Add("motes", 0);
- var junk = new Dictionary<string, int>();
- bool haveBreak = false;
- while (true)
- {
- string[] legendaryItem = Console.ReadLine().
- Split(' ', StringSplitOptions.RemoveEmptyEntries).
- ToArray();
- for (int i = 0; i < legendaryItem.Length; i += 2)
- {
- int quantity = int.Parse(legendaryItem[i]);
- string legentItem = legendaryItem[i + 1].ToLower();
- if (legentItem == "shards" || legentItem == "fragments" || legentItem == "motes")
- {
- legendaryItemValue[legentItem] += quantity;
- if (legendaryItemValue[legentItem] >= 250)
- {
- if (legentItem == "shards")
- {
- Console.WriteLine($"Shadowmourne obtained!");
- }
- else if (legentItem == "fragments")
- {
- Console.WriteLine("Valanyr obtained!");
- }
- else if (legentItem == "motes")
- {
- Console.WriteLine("Dragonwrath obtained!");
- }
- legendaryItemValue[legentItem] -= 250;
- haveBreak = true;
- break;
- }
- }
- else
- {
- if (!junk.ContainsKey(legentItem))
- {
- junk.Add(legentItem, quantity);
- }
- else
- {
- junk[legentItem] += quantity;
- }
- }
- }
- if (haveBreak)
- {
- break;
- }
- }
- foreach (var item in legendaryItemValue.OrderByDescending(x => x.Value).ThenBy(x => x.Key))
- {
- Console.WriteLine(item.Key + ": " + item.Value);
- }
- foreach (var item in junk.OrderBy(x => x.Key))
- {
- Console.WriteLine(item.Key + ": " + item.Value);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement