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());
        }
        public static IEnumerable <EVEMaterial> ProductionExtraMaterials(string typeName)
        {
            invType dcType = TypesHelper.GetType(typeName);

            List <EVEMaterial> matInfo = new List <EVEMaterial>();
            invBlueprintType   bpType  = TypesHelper.GetBlueprintType(dcType);

            if (bpType != null)
            {
                foreach (ramTypeRequirement m in TypesHelper.GetRamTypeRequirements(bpType).Where(x => x.activityID == 1))
                {
                    matInfo.Add(new EVEMaterial(EVECache.GetItem(m.requiredTypeID), m.quantity.Value, m.damagePerJob.Value, true));
                }
            }

            return(matInfo);
        }
        public static double GetBaseInventionChance(string typeName)
        {
            EVEItem item = EVECache.GetItem(typeName);

            switch (item.GroupID)
            {
            case 25:
            case 420:
            case 513:
            case 893:
            case 902:
            case 324:
            case 830:
            case 831:
            case 541:
            case 834:
                return(0.3);

            case 26:
            case 28:
            case 894:
            case 906:
            case 833:
            case 358:
            case 832:
            case 380:
                return(0.25);

            case 27:
            case 419:
            case 898:
            case 900:
            case 540:
                return(0.2);

            default:
                return(0.4);
            }
        }
        public static IEnumerable <EVEMaterial> GetInventionRequirements(string t2ItemName)
        {
            List <EVEMaterial> result = new List <EVEMaterial>();

            invType          t1type = TypesHelper.GetMeta0Type(t2ItemName);
            invBlueprintType bpType = TypesHelper.GetBlueprintType(t1type);
            IEnumerable <ramTypeRequirement> ramReqs = TypesHelper.GetRamTypeRequirements(bpType).Where(x => x.activityID == 8);

            foreach (ramTypeRequirement r in ramReqs)
            {
                invType     reqType = TypesHelper.GetType(r.requiredTypeID);
                EVEMaterial newMat  = new EVEMaterial(EVECache.GetItem(reqType), r.quantity.Value, r.damagePerJob.Value, true);

                if (reqType.groupID == 716)
                {
                    newMat.damage = 0;
                }

                result.Add(newMat);
            }

            return(result);
        }
        public static EVEBlueprint GetBlueprint(string productTypeName)
        {
            EVEBlueprint blueprint = new EVEBlueprint();

            if (productTypeName != null)
            {
                blueprint.Product = EVECache.GetItem(productTypeName);
            }

            var x = TypesHelper.GetBlueprintType(blueprint.Product.TypeID);

            blueprint.Blueprint = EVECache.GetItem(x.blueprintTypeID);

            blueprint.MaxRuns            = x.maxProductionLimit.Value;
            blueprint.BaseInventionTime  = x.researchTechTime.Value;
            blueprint.BaseProductionTime = x.productionTime.Value;

            blueprint.MaterialEfficiency   = -4;
            blueprint.ProductionEfficiency = -4;
            blueprint.NumRuns = blueprint.MaxRuns / 10;

            return(blueprint);
        }
        public static IEnumerable <EVEItem> GetInventableProducts()
        {
            TypesDataContext context = new TypesDataContext();

            List <int> knownSkills = new List <int>();

            knownSkills.Add(20423);
            knownSkills.Add(20424);
            knownSkills.Add(20418);

            foreach (int typeID in (from req in context.ramTypeRequirements
                                    where req.activityID == 8
                                    select req.typeID).Distinct())
            {
                var x = (from req in context.ramTypeRequirements
                         where req.activityID == 8 && req.typeID == typeID && knownSkills.Contains(req.requiredTypeID)
                         select req.typeID).Count();
                if (x == 2)
                {
                    yield return(EVECache.GetItem(typeID));
                }
            }
        }