public static IEnumerable <EVEMaterial> ProductionBaseMaterials(string typeName) { invType dcType = TypesHelper.GetType(typeName); Dictionary <int, EVEMaterial> matInfo = new Dictionary <int, EVEMaterial>(); foreach (invTypeMaterial m in TypesHelper.GetTypeMaterials(dcType)) { matInfo[m.materialTypeID] = new EVEMaterial(EVECache.GetItem(m.materialTypeID), m.quantity, 1.0, false); } invBlueprintType bpType = TypesHelper.GetBlueprintType(dcType); if (bpType != null) { foreach (ramTypeRequirement m in TypesHelper.GetRamTypeRequirements(bpType).Where(x => x.activityID == 1)) { if (m.recycle.Value) { IEnumerable <EVEMaterial> subMats = ProductionBaseMaterials(TypesHelper.GetType(m.requiredTypeID).typeName); foreach (EVEMaterial subMat in subMats) { if (matInfo.ContainsKey(subMat.item.TypeID)) { matInfo[subMat.item.TypeID].quantity -= subMat.quantity; } } } } } return(matInfo.Values.Where(x => x.quantity > 0).OrderByDescending(x => x.quantity).ToList()); }