public Stage GetPetStage(int stageId) { using (var db = new SQLite.SQLiteConnection(Constants.DbPath)) { Stage stage = new Stage(); try { stage = (db.Table<Stage>().Where( s => s.StageId == stageId)).SingleOrDefault(); } catch { stage = null; } return stage; } }
internal Stage GetPetNewStage(int age) { using (var db = new SQLite.SQLiteConnection(Constants.DbPath)) { Stage stage = new Stage(); try { stage = (db.Table<Stage>().Where( s => s.AgeFrom >= age && s.AgeTo <= age)).SingleOrDefault(); } catch { stage = null; } return stage; } }
private static int CalculateMood(Pet pet, Stage petStage) { return pet.Mood > 0 ? (GetMinutesFromLastUpdated(pet.LastUpdated) - petStage.MoodInterval) * petStage.MoodCoeff : 0; }
private static int CalculateHygene(Pet pet, Stage petStage) { return pet.Hygene > 0 ? (GetMinutesFromLastUpdated(pet.LastUpdated) - petStage.HygeneInterval) * petStage.HygeneCoeff : 0; }
private static int CalculateHunger(Pet pet, Stage petStage) { return pet.Hunger > 0 ? (GetMinutesFromLastUpdated(pet.LastUpdated) - petStage.HungerInterval) * petStage.HungerCoeff : 0; }
private static int CalculateHealth(Pet pet, Stage petStage) { return pet.Health > 0 ? (GetMinutesFromLastUpdated(pet.LastUpdated) - petStage.HealthInterval) * petStage.HealthCoeff : 0; }
private static int CalculateEnergy(Pet pet, Stage petStage) { return pet.Energy > 0 ? (GetMinutesFromLastUpdated(pet.LastUpdated) - petStage.EnergyInterval) * petStage.EnergyCoeff : 0; }