Exemple #1
0
 private void llStatCalculation_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     ArkWiki.OpenPage("Creature_Stats_Calculation");
 }
        public void SetSpecies(Species species, bool forceRefresh = false)
        {
            if (species == null || (_selectedSpecies == species && !forceRefresh))
            {
                return;
            }

            _selectedSpecies = species;

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

            this.SuspendDrawing();
            SuspendLayout();

            string speciesName = species.name;

            linkLabelWikiPage.Text = "Wiki: " + speciesName;
            linkLabelWikiPage.Tag  = speciesName;
            _tt.SetToolTip(linkLabelWikiPage, ArkWiki.WikiUrl(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();
                    flcBodyDamageMultipliers.Controls.Add(rbBD);
                    flcBodyDamageMultipliers.SetFlowBreak(rbBD, true);
                    rbBD.AutoSize = true;

                    _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 = string.Empty;

            // list all recipes of kibbles that give a reasonable affinity (assuming that is larger or equal than 100)
            foreach (var k in Kibbles.K.kibble)
            {
                var kibbleName = $"{k.Key} Kibble";
                var kibbleFood = Values.V.GetTamingFood(species, kibbleName);

                if (kibbleFood != null &&
                    kibbleFood.affinity >= 100)
                {
                    _kibbleRecipe += $"\n\n{k.Key} Kibble:{k.Value.RecipeAsText()}";
                }
            }

            _foodDepletion = td.foodConsumptionBase * td.foodConsumptionMult * _tamingFoodRateMultiplier;

            SetTamingFoodControls(species);

            _updateCalculation = true;
            UpdateFirstFeedingWaiting();
            UpdateTamingData();
            if (Properties.Settings.Default.TamingFoodOrderByTime)
            {
                SetOrderOfTamingFood(true, true);
            }

            ResumeLayout();
            this.ResumeDrawing();
        }