public T2Blueprint(BlueprintID bpID, int matLevel, int prodLevel) { MatLevel = matLevel; ProdLevel = prodLevel; Product = CommonQueries.GetProductFromBlueprint(bpID); Details = CommonQueries.GetBlueprintDetails(bpID); var t1ID = CommonQueries.GetT1VersionOfT2(Product); var t1BPID = CommonQueries.GetBlueprintFromProduct(t1ID); //Console.WriteLine(new T1Blueprint(t1BPID, 0, 0).InventionMaterials); Materials = new List <BPMaterial>(); var rawMaterials = CommonQueries.GetMaterialsRaw(Product); var extraMaterials = CommonQueries.GetMaterialsExtra(bpID); var t1Materials = CommonQueries.GetMaterialsRaw(t1ID); var extraT1Materials = CommonQueries.GetMaterialsExtra(t1BPID); // TODO: currently this assumes there is always exactly 1 recyclable material which is the t1 item var rawMaterialsAfterRecycling = rawMaterials.Subtract(t1Materials); // adjust for ME var adjustedRawMaterials = rawMaterialsAfterRecycling.AdjustForMEWastage(matLevel, Details.wasteFactor); Materials = adjustedRawMaterials.Union(extraMaterials).ToList(); }
public T1Blueprint(BlueprintID bpID, int matlevel, int prodLevel) { MatLevel = matlevel; ProdLevel = prodLevel; Product = CommonQueries.GetProductFromBlueprint(bpID); Details = CommonQueries.GetBlueprintDetails(bpID); Materials = CommonQueries.GetMaterialsRaw(Product) .AdjustForMEWastage(matlevel, Details.wasteFactor) .Union(CommonQueries.GetMaterialsExtra(bpID)) .ToList(); var extraMats = CommonQueries.GetMaterialsExtra(bpID, ActivityIDs.Invention).ToList(); if (extraMats.Any()) { // data dump is terrible and gives data interfaces a damagePerJob of 100% :ccp: InventionMaterials = extraMats .Where(m => m.matID.GetGroupID() != GroupID.DataInterfaces) .ToList(); InventionInterface = extraMats .Single(m => m.matID.GetGroupID() == GroupID.DataInterfaces) .matID; } }
public static IEnumerable <BPMaterial> GetMaterialsExtra(BlueprintID bpID, ActivityIDs activity = ActivityIDs.Manufacturing) { using (var cnn = new SQLiteConnection(DefaultDatabase.dbConnection)) { cnn.Open(); var query = string.Format(@" SELECT t.typeName, r.requiredTypeID, r.quantity, r.damagePerJob FROM ramTypeRequirements AS r INNER JOIN invTypes AS t ON r.requiredTypeID = t.typeID INNER JOIN invGroups AS g ON t.groupID = g.groupID WHERE r.typeID = {0} AND r.activityID = {1} AND g.categoryID != {2};", bpID, (int)activity, CategoryID.Skill); var reader = DefaultDatabase.RunSQLTableQuery(query, cnn); var results = new List <BPMaterial>(); while (reader.Read()) { results.Add(new BPMaterial(new MaterialID(reader["requiredTypeID"].ToInt()), reader["quantity"].ToLong(), reader["damagePerJob"].ToDecimal())); } return(results); } }
public static BPDetails GetBlueprintDetails(BlueprintID bpID) { var query = @"select * from invBlueprintTypes where blueprintTypeID = " + bpID + ";"; using (var cnn = new SQLiteConnection(DefaultDatabase.dbConnection)) { cnn.Open(); var reader = DefaultDatabase.RunSQLTableQuery(query, cnn); var results = new List <BPMaterial>(); reader.Read(); return(new BPDetails( reader["productionTime"].ToInt(), reader["researchProductivityTime"].ToInt(), reader["researchMaterialTime"].ToInt(), reader["researchCopyTime"].ToInt(), reader["researchTechTime"].ToInt(), reader["productivityModifier"].ToInt(), reader["materialModifier"].ToInt(), reader["wasteFactor"].ToInt(), reader["maxProductionLimit"].ToInt())); } }
public static MaterialID GetProductFromBlueprint(BlueprintID bpID) { var query = @"select productTypeID from invBlueprintTypes where blueprintTypeID = " + bpID + ";"; return(new MaterialID(DefaultDatabase.RunSQLStringQuery(query).ToInt())); }