public static bool On_ItemsByQuality_RemoveItem(ItemsByQuality self, Item item)
 {
     LargeItemsByMaterial itemsByMaterial = null;
     return myClasses[self].TryGetValue(item.Quality, out itemsByMaterial) && itemsByMaterial.RemoveItem(item);
 }
 public static int On_ItemsByQuality_QuantityInStock(ItemsByQuality self, ItemQuality quality)
 {
     throw new Exception("Thought this function is not used!?");
 }
        public static ItemsByMaterial On_ItemsByQuality_ItemsOfQualityOrHigher(ItemsByQuality self, ItemQuality itemQuality)
        {
            var items = myClasses[self];
            if (itemQuality == ItemQuality.Any)
            {
                itemQuality = ItemQuality.Poor;
            }
            ItemsByMaterial itemsByMaterial = new ItemsByMaterial();
            foreach (KeyValuePair<ItemQuality, LargeItemsByMaterial> current in items)
            {
                if (current.Key >= itemQuality)
                {
                    foreach (KeyValuePair<int, HashSet<Item>> current2 in current.Value.Items)
                    {
                        List<Item> list;
                        if (itemsByMaterial.Items.TryGetValue(current2.Key, out list))
                        {
                            itemsByMaterial.Items[current2.Key] = itemsByMaterial.Items[current2.Key].Concat(current2.Value).ToList<Item>();
                        }
                        else
                        {
#warning have to find a performant way to replace this, likely by replacing lots a stockmanager funcs
                            itemsByMaterial.Items.Add(current2.Key, current2.Value);
                        }
                    }
                }
            }
            return itemsByMaterial;
        }
 public static ItemsByMaterial On_ItemsByQuality_ItemsOfQuality(ItemsByQuality self, ItemQuality quality, bool atLeast)
 {
     if (quality == ItemQuality.Any)
     {
         return self.AllItems();
     }
     if (atLeast)
     {
         return self.ItemsOfQualityOrHigher(quality);
     }
     LargeItemsByMaterial result;
     if (myClasses[self].TryGetValue(quality, out result))
     {
         return result.ToItemsByMaterial();
     }
     return null;
 }
 public static void On_ItemsByQuality_AddItem(ItemsByQuality self, ItemQuality quality, int material)
 {
     var items = myClasses[self];
     LargeItemsByMaterial itemsByMaterial = null;
     if (!items.TryGetValue(quality, out itemsByMaterial))
     {
         itemsByMaterial = new LargeItemsByMaterial();
         items[quality] = itemsByMaterial;
     }
     itemsByMaterial.AddItem(material);
 }
 public static Dictionary<ItemQuality, ItemsByMaterial> Get_ItemsByQuality_Items(ItemsByQuality self)
 {
     var result = new Dictionary<ItemQuality, ItemsByMaterial>();
     foreach (var el in myClasses[self])
     {
         result.Add(el.Key, el.Value.ToItemsByMaterial());
     }
     return result;
 }