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(); 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 = ""; // 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 SetSpecies(Species species, bool forceRefresh = false) { if (species == null || (selectedSpecies == species && !forceRefresh)) { 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(); 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"; if (((td.specialFoodValues != null && td.specialFoodValues.TryGetValue(kibbleName, out var kFood)) || Values.V.defaultFoodData.TryGetValue(kibbleName, out kFood)) && kFood.affinity >= 100) { kibbleRecipe += $"\n\n{k.Key} Kibble:{k.Value.RecipeAsText()}"; } } foodDepletion = td.foodConsumptionBase * td.foodConsumptionMult * tamingFoodRateMultiplier; int i = 0; if (td.eats != null) { for (i = 0; i < td.eats.Length; i++) { string f = td.eats[i]; TamingFoodControl tf; // if Augmented are not wanted, and food control already exist, update it and hide it. if (!checkBoxAugmented.Checked && f.Contains("Augmented")) { if (i < foodControls.Count) { tf = foodControls[i]; tf.FoodName = f; tf.Hide(); } continue; } 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(); } // special cases where a creature eats multiple food items of one kind at once 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 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(); }