Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace LegendaryFarming
- {
- class Program
- {
- // quantity material
- static void Main(string[] args)
- {
- Dictionary<string, int> legendaryItem = new Dictionary<string, int>();
- string items = Console.ReadLine();
- string[] materials = items.Split().ToArray();
- int value = 0;
- for (int i = 0; i < materials.Length; i++)
- {
- string currentValue = materials[i].ToLower();
- if (i % 2 == 0)
- {
- value = int.Parse(currentValue);
- }
- else
- {
- bool ItemExist = legendaryItem.ContainsKey(currentValue);
- if (ItemExist == true)
- {
- legendaryItem[currentValue] += value;
- }
- else
- {
- legendaryItem.Add(currentValue, value);
- }
- }
- }
- foreach (var item in legendaryItem)
- {
- if (item.Key == "fragments" && item.Value >= 250)
- {
- bool shardExist = false;
- bool motesExist = false;
- Console.WriteLine("Valanyr obtained!");
- Dictionary<string, int> legendaryShards = new Dictionary<string, int>();
- if (item.Value >= 250)
- {
- int fragments = item.Value - 250;
- legendaryShards.Add("fragments", fragments);
- }
- foreach (var item1 in legendaryItem)
- {
- if (item1.Key == "shards")
- {
- shardExist = true;
- legendaryShards.Add("shards", item1.Value);
- }
- else if (item1.Key == "motes")
- {
- motesExist = true;
- legendaryShards.Add("motes", item1.Value);
- }
- }
- if (shardExist == false)
- {
- legendaryShards.Add("shards", 0);
- }
- if (motesExist == false)
- {
- legendaryShards.Add("motes", 0);
- }
- foreach (var item2 in legendaryShards.OrderByDescending(p => p.Value).ThenBy(r=> r.Key))
- {
- Console.WriteLine($"{item2.Key} -> {item2.Value}");
- legendaryItem.Remove(item2.Key);
- }
- foreach (var item3 in legendaryItem.OrderBy(p => p.Key))
- {
- Console.WriteLine($"{item3.Key} -> {item3.Value}");
- }
- }
- else if (item.Key == "motes" && item.Value >= 250)
- {
- bool fragmentsExist = false;
- bool shardsExist = false;
- Console.WriteLine("Dragonwrath obtained!");
- Dictionary<string, int> legendaryShards = new Dictionary<string, int>();
- if (item.Value >= 250)
- {
- int motes = item.Value - 250;
- legendaryShards.Add("motes", motes);
- }
- foreach (var item1 in legendaryItem)
- {
- if (item1.Key == "shards")
- {
- shardsExist = true;
- legendaryShards.Add("shards", item1.Value);
- }
- else if (item1.Key == "fragments")
- {
- fragmentsExist = true;
- legendaryShards.Add("fragments", item1.Value);
- }
- }
- if (shardsExist == false)
- {
- legendaryShards.Add("shards", 0);
- }
- if(fragmentsExist == false)
- {
- legendaryShards.Add("fragments", 0);
- }
- foreach (var item2 in legendaryShards.OrderByDescending(p => p.Value).ThenBy(r => r.Key))
- {
- Console.WriteLine($"{item2.Key} -> {item2.Value}");
- legendaryItem.Remove(item2.Key);
- }
- foreach (var item3 in legendaryItem.OrderBy(p => p.Key))
- {
- Console.WriteLine($"{item3.Key} -> {item3.Value}");
- }
- }
- else if (item.Key == "shards" && item.Value >= 250)
- {
- bool fragmentsExist = false;
- bool motesExist = false;
- Console.WriteLine("Shadowmourne obtained!");
- Dictionary<string, int> legendaryShards = new Dictionary<string, int>();
- if (item.Value >= 250)
- {
- int shards = item.Value - 250;
- legendaryShards.Add("shards", shards);
- }
- foreach (var item1 in legendaryItem)
- {
- if (item1.Key == "fragments")
- {
- fragmentsExist = true;
- legendaryShards.Add("fragments", item1.Value);
- }
- else if (item1.Key == "motes")
- {
- motesExist = true;
- legendaryShards.Add("fragments", item1.Value);
- }
- }
- if (motesExist == false)
- {
- legendaryShards.Add("motes", 0);
- }
- if (fragmentsExist == false)
- {
- legendaryShards.Add("fragments", 0);
- }
- foreach (var item2 in legendaryShards.OrderByDescending(p => p.Value).ThenBy(r => r.Key))
- {
- Console.WriteLine($"{item2.Key} -> {item2.Value}");
- legendaryItem.Remove(item2.Key);
- }
- foreach (var item3 in legendaryItem.OrderBy(p => p.Key))
- {
- Console.WriteLine($"{item3.Key} -> {item3.Value}");
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment