public static bool getRaisingTimes(int speciesIndex, out string incubationMode, out TimeSpan incubation, out TimeSpan baby, out TimeSpan maturation, out TimeSpan nextMatingMin, out TimeSpan nextMatingMax) { incubation = new TimeSpan(); baby = new TimeSpan(); maturation = new TimeSpan(); nextMatingMin = new TimeSpan(); nextMatingMax = new TimeSpan(); incubationMode = ""; if (speciesIndex < 0 || speciesIndex > Values.V.species.Count || Values.V.species[speciesIndex].breeding == null) { return(false); } BreedingData breeding = Values.V.species[speciesIndex].breeding; nextMatingMin = new TimeSpan(0, 0, (int)(breeding.matingCooldownMinAdjusted)); nextMatingMax = new TimeSpan(0, 0, (int)(breeding.matingCooldownMaxAdjusted)); incubationMode = "Gestation"; if (breeding.gestationTimeAdjusted == 0) { incubationMode = "Incubation"; } incubation = new TimeSpan(0, 0, (int)(breeding.incubationTimeAdjusted + breeding.gestationTimeAdjusted)); baby = new TimeSpan(0, 0, (int)(.1f * breeding.maturationTimeAdjusted)); maturation = new TimeSpan(0, 0, (int)(breeding.maturationTimeAdjusted)); return(true); }
public static string eggTemperature(int speciesIndex) { if (speciesIndex >= 0 && speciesIndex < Values.V.species.Count && Values.V.species[speciesIndex].breeding != null && Values.V.species[speciesIndex].breeding.eggTempMin > 0) { BreedingData breeding = Values.V.species[speciesIndex].breeding; return("Egg-Temperature: " + (Values.V.celsius ? breeding.eggTempMin : Math.Round(breeding.eggTempMin * 1.8 + 32, 1)) + " - " + (Values.V.celsius ? breeding.eggTempMax : Math.Round(breeding.eggTempMax * 1.8 + 32, 1)) + (Values.V.celsius ? " °C" : " °F")); } return(""); }
public void updateRaisingData(int speciesIndex, bool forceUpdate = false) { if (forceUpdate || this.speciesIndex != speciesIndex) { this.speciesIndex = speciesIndex; if (speciesIndex >= 0 && Values.V.species[speciesIndex].taming != null && Values.V.species[speciesIndex].breeding != null) { this.SuspendLayout(); BreedingData bd = Values.V.species[speciesIndex].breeding; listViewRaisingTimes.Items.Clear(); if (Raising.getRaisingTimes(speciesIndex, out string incubationMode, out TimeSpan incubationTime, out babyTime, out maturationTime, out TimeSpan nextMatingMin, out TimeSpan nextMatingMax)) { string eggInfo = Raising.eggTemperature(speciesIndex); if (eggInfo.Length > 0) { eggInfo = "\n\n" + eggInfo; } TimeSpan totalTime = incubationTime; DateTime until = DateTime.Now.Add(totalTime); string[] times = { incubationMode, incubationTime.ToString("d':'hh':'mm':'ss"), totalTime.ToString("d':'hh':'mm':'ss"), Utils.shortTimeDate(until) }; listViewRaisingTimes.Items.Add(new ListViewItem(times)); totalTime += babyTime; until = DateTime.Now.Add(totalTime); times = new[] { "Baby", babyTime.ToString("d':'hh':'mm':'ss"), totalTime.ToString("d':'hh':'mm':'ss"), Utils.shortTimeDate(until) }; listViewRaisingTimes.Items.Add(new ListViewItem(times)); totalTime = incubationTime + maturationTime; until = DateTime.Now.Add(totalTime); times = new[] { "Maturation", maturationTime.ToString("d':'hh':'mm':'ss"), totalTime.ToString("d':'hh':'mm':'ss"), Utils.shortTimeDate(until) }; listViewRaisingTimes.Items.Add(new ListViewItem(times)); // food amount needed string foodamount = ""; if (Values.V.species[speciesIndex].taming.eats != null && uiControls.Trough.foodAmount(speciesIndex, Values.V.babyFoodConsumptionSpeedMultiplier, out double babyfood, out double totalfood)) { if (Values.V.species[speciesIndex].taming.eats.IndexOf("Raw Meat") >= 0) { foodamount = "\n\nFood for Baby-Phase: ~" + Math.Ceiling(babyfood / 50) + " Raw Meat" + "\nTotal Food for maturation: ~" + Math.Ceiling(totalfood / 50) + " Raw Meat"; } else if (Values.V.species[speciesIndex].taming.eats.IndexOf("Mejoberry") >= 0) { foodamount = "\n\nFood for Baby-Phase: ~" + Math.Ceiling(babyfood / 30) + " Mejoberries" + "\nTotal Food for maturation: ~" + Math.Ceiling(totalfood / 30) + " Mejoberries"; } foodamount += "\n - Loss by spoiling is only a rough estimate and may vary."; } labelRaisingInfos.Text = "Time between mating: " + nextMatingMin.ToString("d':'hh':'mm':'ss") + " to " + nextMatingMax.ToString("d':'hh':'mm':'ss") + eggInfo + foodamount; tabPageMaturationProgress.Enabled = true; } else { labelRaisingInfos.Text = "No raising-data available."; tabPageMaturationProgress.Enabled = false; } ResumeLayout(); } else { // no taming- or breeding-data available labelRaisingInfos.Text = "No raising-data available."; tabPageMaturationProgress.Enabled = false; } }