public static IEnumerable <BPMaterial> GetMaterialsReprocessing(MaterialID material) { return(GetMaterialsRaw(material)); // seems like // var query = @"SELECT t.MaterialID, m.quantity //FROM invTypeMaterials AS m // INNER JOIN invTypes AS t // ON m.materialTypeID = t.MaterialID //WHERE m.MaterialID =" + material + ";"; // var results = DefaultDatabase.RunSQLTableQuery(query); // return from DataRow row in results.Rows // select new BPMaterial(row["MaterialID"].ToInt(), row["quantity"].ToLong()); }
public static IEnumerable <MaterialID> GetMetaGroupVersionOfT1(MaterialID matID, int metaGroupID) { using (var cnn = new SQLiteConnection(DefaultDatabase.dbConnection)) { cnn.Open(); var query = @"select typeId from invMetaTypes where parentTypeID = " + matID + " and metaGroupID = " + metaGroupID; var results = DefaultDatabase.RunSQLTableQuery(query, cnn); var t1Name = CommonQueries.GetTypeName(matID); while (results.Read()) { yield return(new MaterialID(results["typeID"].ToInt())); } } }
public static IEnumerable <BPMaterial> GetMaterialsRaw(MaterialID material) { using (var cnn = new SQLiteConnection(DefaultDatabase.dbConnection)) { cnn.Open(); var query = @"SELECT m.materialTypeID, m.quantity FROM invTypeMaterials AS m INNER JOIN invTypes AS t ON m.typeID = t.typeID WHERE m.typeID = " + material + ";"; var reader = DefaultDatabase.RunSQLTableQuery(query, cnn); var results = new List <BPMaterial>(); while (reader.Read()) { results.Add(new BPMaterial(new MaterialID(reader["materialTypeID"].ToInt()), reader["quantity"].ToLong())); } return(results); } }
private Decryptor WithName(string name) { Name = name; MaterialID = CommonQueries.GetMaterialID(name); return(this); }
// todo: this might get called a fuckton and need caching (also GetGroupID) public static GroupID GetGroupID(this MaterialID matID) { var query = @"select groupID from invTypes where typeID = " + matID + ";"; return(new GroupID(DefaultDatabase.RunSQLStringQuery(query).ToInt())); }
public static BlueprintID GetBlueprintFromProduct(MaterialID matID) { // not sure if there's a better way of doing this return(GetBlueprintID(GetTypeName(matID))); }
public static MaterialID GetT2VersionOfT1(MaterialID matID, string outputName = null) { var result = GetMetaGroupVersionOfT1(matID, 2); // note metaGroup not metaLevel return(result.FirstOrDefault(r => outputName != null ? CommonQueries.GetTypeName(r) == outputName : true)); }
public static MaterialID GetT1VersionOfT2(MaterialID matID) { var query = @"select parentTypeID from invMetaTypes where typeID = " + matID + ";"; return(new MaterialID(DefaultDatabase.RunSQLStringQuery(query).ToInt())); }
public static CategoryID GetCategoryID(this MaterialID matID) { return(GetCategoryID(GetGroupID(matID))); }
public BPMaterial(MaterialID matID, long quantity, decimal damagePerJob = 1) { this.matID = matID; this.quantity = quantity; this.damagePerJob = damagePerJob; }