Exemple #1
0
 public MedicineItem GetMedicineItem(string id)
 {
     try
     {
         if (string.IsNullOrEmpty(id))
         {
             return(null);
         }
         string ID = "'" + id + "'";
         SimpleSQL.SimpleDataTable dt = dbManager.QueryGeneric(
             "SELECT " + "*" +
             "FROM " +
             "MedicineItem " +
             "WHERE " + "ID LIKE " + ID
             );
         MedicineItem medicine = new MedicineItem(dt.rows[0]["ID"].ToString(), dt.rows[0]["Name"].ToString(), dt.rows[0]["Description"].ToString(), dt.rows[0]["Icon"].ToString(), (int)dt.rows[0]["MaxCount"],
                                                  float.Parse(dt.rows[0]["Weight"].ToString()), (int)dt.rows[0]["BuyPrice"], (int)dt.rows[0]["SellPrice"], (int)dt.rows[0]["SellAble"] == 1, (int)dt.rows[0]["Usable"] == 1,
                                                  dt.rows[0]["HP_Rec"] == null ? 0 : (int)dt.rows[0]["HP_Rec"], dt.rows[0]["MP_Rec"] == null ? 0 : (int)dt.rows[0]["MP_Rec"], dt.rows[0]["Endurance_Rec"] == null ? 0 : (int)dt.rows[0]["Endurance_Rec"]);
         if (dt.rows[0]["Materials"] != null)
         {
             medicine.MaterialsListInput = dt.rows[0]["Materials"].ToString();
         }
         medicine.SetMaterials(this);
         return(medicine);
     }
     catch (System.Exception ex)
     {
         Debug.Log("\"" + id + "\"" + ex.Message);
         return(null);
     }
 }