Esempio n. 1
0
        public static bool getRaisingTimes(int speciesIndex, double matingmultiplier, double incubationMultiplier, double matureMultiplier, 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 * matingmultiplier));
            nextMatingMax = new TimeSpan(0, 0, (int)(breeding.matingCooldownMaxAdjusted * matingmultiplier));

            incubationMode = "Gestation";
            if (breeding.gestationTimeAdjusted == 0)
            {
                incubationMode = "Incubation";
            }

            incubation = new TimeSpan(0, 0, (int)((breeding.incubationTimeAdjusted + breeding.gestationTimeAdjusted) * incubationMultiplier));
            baby       = new TimeSpan(0, 0, (int)(.1f * breeding.maturationTimeAdjusted * matureMultiplier));
            maturation = new TimeSpan(0, 0, (int)(breeding.maturationTimeAdjusted * matureMultiplier));
            return(true);
        }
Esempio n. 2
0
 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("");
 }
Esempio n. 3
0
        public void displayData(int speciesIndex)
        {
            if (speciesIndex >= 0 && speciesIndex < Values.V.species.Count)
            {
                BreedingData breeding     = Values.V.species[speciesIndex].breeding;
                string       breedingInfo = "";

                string firstTime = "Gestation";
                if (breeding.gestationTimeAdjusted <= 0)
                {
                    firstTime = "Incubation";
                }

                string[] rowNames = { firstTime, "Baby", "Maturation" };
                for (int k = 0; k < 3; k++)
                {
                    int t1, totalTime = 0;
                    switch (k)
                    {
                    default:
                    case 0:
                        t1        = (int)(breeding.gestationTimeAdjusted == 0 ? breeding.incubationTimeAdjusted : breeding.gestationTimeAdjusted);
                        totalTime = t1;
                        break;

                    case 1:
                        t1        = (int)(.1f * breeding.maturationTimeAdjusted);
                        totalTime = t1;
                        break;

                    case 2:
                        t1        = (int)breeding.maturationTimeAdjusted;
                        totalTime = (int)(breeding.gestationTimeAdjusted + breeding.incubationTimeAdjusted + breeding.maturationTimeAdjusted);
                        break;
                    }

                    string[] subitems =
                    {
                        rowNames[k],
                        new TimeSpan(0, 0, t1).ToString("d':'hh':'mm':'ss"),
                        new TimeSpan(0, 0, totalTime).ToString("d':'hh':'mm':'ss"),
                        DateTime.Now.AddSeconds(totalTime).ToShortTimeString() + ", " + DateTime.Now.AddSeconds(totalTime).ToShortDateString()
                    };
                    //listView1.Items.Add(new ListViewItem(subitems));
                    breedingInfo += string.Join(", ", subitems) + "\n";
                }

                breedingInfo += "\n";

                buttonHatching.Text = firstTime;

                // further info
                if (breeding.eggTempMin > 0)
                {
                    breedingInfo += "Egg-Temperature:\n"
                                    + (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");
                }
                if (breeding.eggTempMin > 0 && breeding.matingCooldownMinAdjusted > 0)
                {
                    breedingInfo += "\n\n";
                }
                if (breeding.matingCooldownMinAdjusted > 0)
                {
                    breedingInfo += "Time until next mating is possible:\n" + new TimeSpan(0, 0, (int)breeding.matingCooldownMinAdjusted).ToString("d':'hh':'mm") + " - " + new TimeSpan(0, 0, (int)breeding.matingCooldownMaxAdjusted).ToString("d':'hh':'mm");
                }
                labelBreedingInfos.Text = breedingInfo;
            }
        }
        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;
                    string incubationMode;
                    TimeSpan incubationTime, nextMatingMin, nextMatingMax;

                listViewRaisingTimes.Items.Clear();

                if (Raising.getRaisingTimes(speciesIndex, out incubationMode, out incubationTime, out babyTime, out maturationTime, out nextMatingMin, out 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 = new string[] { 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 string[] { "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 string[] { "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 foodadmount = "";
                        double babyfood, totalfood;
                        if (Values.V.species[speciesIndex].taming.eats != null &&
                            uiControls.Trough.foodAmount(speciesIndex, Values.V.babyFoodConsumptionSpeedMultiplier, out babyfood, out totalfood))
                        {
                            if (Values.V.species[speciesIndex].taming.eats.IndexOf("Raw Meat") >= 0)
                            {
                                foodadmount = "\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)
                            {
                                foodadmount = "\n\nFood for Baby-Phase: ~" + Math.Ceiling(babyfood / 30) + " Mejoberries"
                                    + "\nTotal Food for maturation: ~" + Math.Ceiling(totalfood / 30) + " Mejoberries";
                            }
                            foodadmount += "\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
                            + foodadmount;

                        tabPageMaturationProgress.Enabled = true;
                    }
                    else
                    {
                        labelRaisingInfos.Text = "No raising-data available.";
                        tabPageMaturationProgress.Enabled = false;
                    }

                    labelRaisingInfos.Text = "Time between mating: " + nextMatingMin.ToString("d':'hh':'mm':'ss") + " to " + nextMatingMax.ToString("d':'hh':'mm':'ss")
                        + eggInfo
                        + foodadmount;

                        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;
                }
            }
Esempio n. 5
0
        private void setBreedingData(string species = "")
        {
            int si = Values.V.speciesNames.IndexOf(species);

            listView1.Items.Clear();
            if (si < 0 || Values.V.species[si].breeding == null)
            {
                listView1.Items.Add("n/a yet");
            }
            else
            {
                BreedingData breeding = Values.V.species[si].breeding;

                string firstTime = "Pregnancy";
                if (breeding.pregnancyTimeAdjusted <= 0)
                {
                    firstTime = "Incubation";
                }


                int    babyTime = (int)Math.Ceiling(breeding.maturationTimeAdjusted * .1);
                double fullTime = breeding.maturationTimeAdjusted;

                string[] rowNames = new string[] { firstTime, "Baby", "Maturation" };
                for (int k = 0; k < 3; k++)
                {
                    int t1, totalTime = 0;
                    switch (k)
                    {
                    default:
                    case 0: t1 = breeding.pregnancyTimeAdjusted == 0 ? breeding.incubationTimeAdjusted : breeding.pregnancyTimeAdjusted; totalTime = t1; break;

                    case 1: t1 = (int)(.1f * breeding.maturationTimeAdjusted); totalTime += t1; break;

                    case 2: t1 = breeding.maturationTimeAdjusted; totalTime = breeding.pregnancyTimeAdjusted + breeding.incubationTimeAdjusted + breeding.maturationTimeAdjusted; break;
                    }

                    string[] subitems = new string[] { rowNames[k],
                                                       new TimeSpan(0, 0, t1).ToString("d':'hh':'mm':'ss"),
                                                       new TimeSpan(0, 0, totalTime).ToString("d':'hh':'mm':'ss"),
                                                       DateTime.Now.AddSeconds(totalTime).ToShortTimeString() + ", " + DateTime.Now.AddSeconds(totalTime).ToShortDateString() };
                    listView1.Items.Add(new ListViewItem(subitems));
                }
                incubation          = new TimeSpan(0, 0, breeding.pregnancyTimeAdjusted + breeding.incubationTimeAdjusted);
                growing             = new TimeSpan(0, 0, breeding.maturationTimeAdjusted);
                buttonHatching.Text = firstTime;

                // further info
                string breedingInfo = "";
                if (breeding.eggTempMin > 0)
                {
                    breedingInfo += "Egg-Temperature:\n"
                                    + (Properties.Settings.Default.celsius ? breeding.eggTempMin : Math.Round(breeding.eggTempMin * 1.8 + 32, 1)) + " - "
                                    + (Properties.Settings.Default.celsius ? breeding.eggTempMax : Math.Round(breeding.eggTempMax * 1.8 + 32, 1))
                                    + (Properties.Settings.Default.celsius? " °C" : " °F");
                }
                if (breeding.eggTempMin > 0 && breeding.matingCooldownMinAdjusted > 0)
                {
                    breedingInfo += "\n\n";
                }
                if (breeding.matingCooldownMinAdjusted > 0)
                {
                    breedingInfo += "Time until next mating is possible:\n" + new TimeSpan(0, 0, breeding.matingCooldownMinAdjusted).ToString("d':'hh':'mm") + " - " + new TimeSpan(0, 0, breeding.matingCooldownMaxAdjusted).ToString("d':'hh':'mm");
                }
                labelBreedingInfos.Text = breedingInfo;
            }
        }