Exemple #1
0
        public void setSpeciesIndex(int speciesIndex)
        {
            if (speciesIndex >= 0 && Values.V.species[speciesIndex].taming != null && this.speciesIndex != speciesIndex)
            {
                this.SuspendLayout();

                this.speciesIndex = speciesIndex;

                // bone damage adjusters
                Dictionary <double, string> boneDamageAdjusters = new Dictionary <double, string>();
                boneDamageAdjustersImmobilization = Taming.boneDamageAdjustersImmobilization(speciesIndex, out boneDamageAdjusters);

                int ib = 0;
                foreach (KeyValuePair <double, string> bd in boneDamageAdjusters)
                {
                    ib++;
                    if (ib >= rbBoneDamageAdjusters.Count)
                    {
                        RadioButton rbBD = new RadioButton();
                        gbWeaponDamage.Controls.Add(rbBD);
                        rbBD.Location = new Point(6, 173 + 19 * ib);
                        rbBD.AutoSize = false;
                        rbBD.Size     = new Size(194, 17);

                        rbBoneDamageAdjusters.Add(rbBD);
                        rbBoneDamageAdjusterValues.Add(1);
                        rbBD.CheckedChanged += new System.EventHandler(this.rbBoneDamage_CheckedChanged);
                    }
                    rbBoneDamageAdjusterValues[ib]    = bd.Key;
                    rbBoneDamageAdjusters[ib].Text    = bd.Value + " (" + bd.Key.ToString() + "×)";
                    rbBoneDamageAdjusters[ib].Visible = true;
                }
                for (int j = ib + 1; j < rbBoneDamageAdjusters.Count; j++)
                {
                    rbBoneDamageAdjusters[j].Visible = false;
                }
                rbBoneDamageAdjusters[0].Checked = true;
                // bone damage adjusters adjusted

                updateCalculation = false;
                TamingData td = Values.V.species[speciesIndex].taming;
                favoriteKibble = td.favoriteKibble;

                foodDepletion = td.foodConsumptionBase * td.foodConsumptionMult * tamingFoodRateMultiplier;

                TamingFoodControl tf;
                int i = 0;
                if (td.eats != null)
                {
                    for (i = 0; i < td.eats.Count; i++)
                    {
                        string f = td.eats[i];
                        if (i >= foodControls.Count)
                        {
                            tf               = new TamingFoodControl(f);
                            tf.Location      = new Point(20, 80 + 45 * i);
                            tf.valueChanged += new TamingFoodControl.ValueChangedEventHandler(updateTamingData);
                            tf.Clicked      += new TamingFoodControl.ClickedEventHandler(onlyOneFood);
                            foodControls.Add(tf);
                            Controls.Add(tf);
                        }
                        else
                        {
                            tf          = foodControls[i];
                            tf.FoodName = f;
                            tf.Show();
                        }
                        if (f == "Kibble")
                        {
                            tf.foodNameDisplay = "Kibble (" + td.favoriteKibble + " Egg)";
                        }
                        if (td.specialFoodValues != null && td.specialFoodValues.ContainsKey(f) && td.specialFoodValues[f].quantity > 1)
                        {
                            tf.foodNameDisplay = td.specialFoodValues[f].quantity.ToString() + "× " + tf.foodNameDisplay;
                        }
                    }
                }

                for (int fci = foodControls.Count - 1; fci >= i; fci--)
                {
                    foodControls[fci].Hide();
                }

                if (i > 0)
                {
                    foodControls[0].amount = Taming.foodAmountNeeded(speciesIndex, (int)nudLevel.Value, tamingSpeedMultiplier, foodControls[0].FoodName, td.nonViolent);
                }

                updateCalculation = true;
                updateFirstFeedingWaiting();
                updateTamingData();

                ResumeLayout();
            }
        }
        public void setSpeciesIndex(int speciesIndex)
        {
            if (speciesIndex >= 0 && Values.V.species[speciesIndex].taming != null)
            {
                this.speciesIndex = speciesIndex;

                boneDamageAdjustersImmobilization = Taming.boneDamageAdjustersImmobilization(speciesIndex);

                updateCalculation = false;
                this.SuspendLayout();
                TamingData td = Values.V.species[speciesIndex].taming;


                foodDepletion = td.foodConsumptionBase * td.foodConsumptionMult * tamingFoodRateMultiplier;

                TamingFoodControl tf;
                int i = 0;
                if (td.eats != null)
                {
                    for (i = 0; i < td.eats.Count; i++)
                    {
                        string f = td.eats[i];
                        if (i >= foodControls.Count)
                        {
                            tf               = new TamingFoodControl(f);
                            tf.Location      = new Point(20, 80 + 45 * i);
                            tf.valueChanged += new TamingFoodControl.ValueChangedEventHandler(updateTamingData);
                            tf.Clicked      += new TamingFoodControl.ClickedEventHandler(onlyOneFood);
                            foodControls.Add(tf);
                            Controls.Add(tf);
                        }
                        else
                        {
                            tf          = foodControls[i];
                            tf.FoodName = f;
                            tf.Show();
                        }
                        if (f == "Kibble")
                        {
                            tf.foodNameDisplay = "Kibble (" + td.favoriteKibble + " Egg)";
                        }
                        if (td.specialFoodValues != null && td.specialFoodValues.ContainsKey(f) && td.specialFoodValues[f].quantity > 1)
                        {
                            tf.foodNameDisplay = td.specialFoodValues[f].quantity.ToString() + "× " + tf.foodNameDisplay;
                        }
                    }
                }

                for (int fci = foodControls.Count - 1; fci >= i; fci--)
                {
                    foodControls[fci].Hide();
                }

                if (i > 0)
                {
                    foodControls[0].amount = Taming.foodAmountNeeded(speciesIndex, (int)nudLevel.Value, tamingSpeedMultiplier, foodControls[0].FoodName, td.nonViolent);
                }

                updateCalculation = true;
                updateFirstFeedingWaiting();
                updateTamingData();

                ResumeLayout();
            }
        }
Exemple #3
0
        public void SetSpecies(Species species)
        {
            if (species == null || selectedSpecies == species)
            {
                return;
            }

            selectedSpecies = species;

            if (species.taming == null)
            {
                NoTamingData();
                return;
            }

            SuspendLayout();

            string speciesName = species.name;

            linkLabelWikiPage.Text = "Wiki: " + speciesName;
            linkLabelWikiPage.Tag  = speciesName;

            // bone damage adjusters
            boneDamageAdjustersImmobilization = Taming.boneDamageAdjustersImmobilization(selectedSpecies,
                                                                                         out Dictionary <string, double> boneDamageAdjusters);

            int ib = 0;

            foreach (KeyValuePair <string, double> bd in boneDamageAdjusters)
            {
                ib++;
                if (ib >= rbBoneDamageAdjusters.Count)
                {
                    RadioButton rbBD = new RadioButton();
                    gbWeaponDamage.Controls.Add(rbBD);
                    rbBD.Location = new Point(6, 199 + 19 * ib);
                    rbBD.AutoSize = false;
                    rbBD.Size     = new Size(194, 17);

                    rbBoneDamageAdjusters.Add(rbBD);
                    rbBoneDamageAdjusterValues.Add(1);
                    rbBD.CheckedChanged += rbBoneDamage_CheckedChanged;
                }
                rbBoneDamageAdjusterValues[ib]    = bd.Value;
                rbBoneDamageAdjusters[ib].Text    = $"{Loc.s(bd.Key)} (× {bd.Value})";
                rbBoneDamageAdjusters[ib].Visible = true;
            }
            for (int j = ib + 1; j < rbBoneDamageAdjusters.Count; j++)
            {
                rbBoneDamageAdjusters[j].Visible = false;
            }
            rbBoneDamageAdjusters[0].Checked = true;
            // bone damage adjusters adjusted

            updateCalculation = false;
            TamingData td = species.taming;

            kibbleRecipe = "";


            // TODO replace with new kibble recipes
            //if (td.favoriteKibble != null && Kibbles.K.kibble.ContainsKey(td.favoriteKibble))
            //{
            //    kibbleRecipe = "\n\nKibble:" + Kibbles.K.kibble[td.favoriteKibble].RecipeAsText();
            //}

            foodDepletion = td.foodConsumptionBase * td.foodConsumptionMult * tamingFoodRateMultiplier;

            int i = 0;

            if (td.eats != null)
            {
                for (i = 0; i < td.eats.Count; i++)
                {
                    string            f = td.eats[i];
                    TamingFoodControl tf;
                    if (i >= foodControls.Count)
                    {
                        tf = new TamingFoodControl(f);
                        tf.valueChanged += UpdateTamingData;
                        tf.Clicked      += OnlyOneFood;
                        foodControls.Add(tf);
                        flpTamingFood.Controls.Add(tf);
                    }
                    else
                    {
                        tf          = foodControls[i];
                        tf.FoodName = f;
                        tf.Show();
                    }
                    if (f == "Kibble")
                    {
                        tf.foodNameDisplay = $"Kibble ({td.favoriteKibble} {Loc.s("Egg")})";
                    }
                    if (td.specialFoodValues != null && td.specialFoodValues.ContainsKey(f) && td.specialFoodValues[f].quantity > 1)
                    {
                        tf.foodNameDisplay = td.specialFoodValues[f].quantity + "× " + tf.foodNameDisplay;
                    }
                }
            }

            for (int fci = foodControls.Count - 1; fci >= i; fci--)
            {
                foodControls[fci].Hide();
            }

            if (i > 0)
            {
                foodControls[0].amount = Taming.foodAmountNeeded(species, (int)nudLevel.Value, tamingSpeedMultiplier, foodControls[0].FoodName, td.nonViolent);
            }

            updateCalculation = true;
            UpdateFirstFeedingWaiting();
            UpdateTamingData();

            ResumeLayout();
        }
        public void setSpeciesIndex(int speciesIndex)
        {
            if (speciesIndex >= 0 && Values.V.species[speciesIndex].taming != null && this.speciesIndex != speciesIndex)
            {
                SuspendLayout();

                this.speciesIndex = speciesIndex;

                // bone damage adjusters
                boneDamageAdjustersImmobilization = Taming.boneDamageAdjustersImmobilization(speciesIndex,
                                                                                             out Dictionary <double, string> boneDamageAdjusters);

                int ib = 0;
                foreach (KeyValuePair <double, string> bd in boneDamageAdjusters)
                {
                    ib++;
                    if (ib >= rbBoneDamageAdjusters.Count)
                    {
                        RadioButton rbBD = new RadioButton();
                        gbWeaponDamage.Controls.Add(rbBD);
                        rbBD.Location = new Point(6, 199 + 19 * ib);
                        rbBD.AutoSize = false;
                        rbBD.Size     = new Size(194, 17);

                        rbBoneDamageAdjusters.Add(rbBD);
                        rbBoneDamageAdjusterValues.Add(1);
                        rbBD.CheckedChanged += rbBoneDamage_CheckedChanged;
                    }
                    rbBoneDamageAdjusterValues[ib]    = bd.Key;
                    rbBoneDamageAdjusters[ib].Text    = $"{Loc.s(bd.Value)} ({bd.Key}×)";
                    rbBoneDamageAdjusters[ib].Visible = true;
                }
                for (int j = ib + 1; j < rbBoneDamageAdjusters.Count; j++)
                {
                    rbBoneDamageAdjusters[j].Visible = false;
                }
                rbBoneDamageAdjusters[0].Checked = true;
                // bone damage adjusters adjusted

                updateCalculation = false;
                TamingData td = Values.V.species[speciesIndex].taming;
                kibbleRecipe = "";

                if (td.favoriteKibble != null && Kibbles.K.kibble.ContainsKey(td.favoriteKibble))
                {
                    kibbleRecipe = "\n\nKibble:" + Kibbles.K.kibble[td.favoriteKibble].RecipeAsText();
                }

                foodDepletion = td.foodConsumptionBase * td.foodConsumptionMult * tamingFoodRateMultiplier;

                int i = 0;
                if (td.eats != null)
                {
                    for (i = 0; i < td.eats.Count; i++)
                    {
                        string            f = td.eats[i];
                        TamingFoodControl tf;
                        if (i >= foodControls.Count)
                        {
                            tf = new TamingFoodControl(f);
                            tf.valueChanged += updateTamingData;
                            tf.Clicked      += onlyOneFood;
                            foodControls.Add(tf);
                            flpTamingFood.Controls.Add(tf);
                        }
                        else
                        {
                            tf          = foodControls[i];
                            tf.FoodName = f;
                            tf.Show();
                        }
                        if (f == "Kibble")
                        {
                            tf.foodNameDisplay = $"Kibble ({td.favoriteKibble} {Loc.s("Egg")})";
                        }
                        if (td.specialFoodValues != null && td.specialFoodValues.ContainsKey(f) && td.specialFoodValues[f].quantity > 1)
                        {
                            tf.foodNameDisplay = td.specialFoodValues[f].quantity + "× " + tf.foodNameDisplay;
                        }
                    }
                }

                for (int fci = foodControls.Count - 1; fci >= i; fci--)
                {
                    foodControls[fci].Hide();
                }

                if (i > 0)
                {
                    foodControls[0].amount = Taming.foodAmountNeeded(speciesIndex, (int)nudLevel.Value, tamingSpeedMultiplier, foodControls[0].FoodName, td.nonViolent);
                }

                updateCalculation = true;
                updateFirstFeedingWaiting();
                updateTamingData();

                ResumeLayout();
            }
        }