public void AddGemItem(gem item) { if (capacity >= current + item.Value && GoldItemsValue >= GemItemsValue + item.Value) { var gemItems = GetGemItems(); if (gemItems.Any(gi => gi.Key == item.Key)) { gemItems.Single(gi => gi.Key == item.Key).IncreaseValue(item.Value); } else { bag1.Add(item); } current += item.Value; } }
private static void InsertItem(string key, long value, bag bag) { if (key.Length == 3) { cash cash = new cash(key, value); bag.AddCashItem(cash); } else if (key.Length >= 4 && key.ToLower().EndsWith("gem")) { gem gem = new gem(key, value); bag.AddGemItem(gem); } else if (key.ToLower().Equals("gold")) { gold gold = new gold(key, value); bag.AddGoldItem(gold); } }
set => SetGemCoord(gem, value);
Find(gem, line, methodTwo, 1);
Find(gem, line, methodOne, 1);