Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
 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()));
         }
     }
 }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
 private Decryptor WithName(string name)
 {
     Name       = name;
     MaterialID = CommonQueries.GetMaterialID(name);
     return(this);
 }
Ejemplo n.º 5
0
        // 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()));
        }
Ejemplo n.º 6
0
 public static BlueprintID GetBlueprintFromProduct(MaterialID matID)
 {
     // not sure if there's a better way of doing this
     return(GetBlueprintID(GetTypeName(matID)));
 }
Ejemplo n.º 7
0
        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));
        }
Ejemplo n.º 8
0
        public static MaterialID GetT1VersionOfT2(MaterialID matID)
        {
            var query = @"select parentTypeID from invMetaTypes where typeID = " + matID + ";";

            return(new MaterialID(DefaultDatabase.RunSQLStringQuery(query).ToInt()));
        }
Ejemplo n.º 9
0
 public static CategoryID GetCategoryID(this MaterialID matID)
 {
     return(GetCategoryID(GetGroupID(matID)));
 }
Ejemplo n.º 10
0
 public BPMaterial(MaterialID matID, long quantity, decimal damagePerJob = 1)
 {
     this.matID        = matID;
     this.quantity     = quantity;
     this.damagePerJob = damagePerJob;
 }