private void btnAddSpec_Click(object sender, EventArgs e) { frmCareer parrent = ParentForm as frmCareer; if (parrent != null) { string confirmstring = string.Format(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseSkillSpecialization"), skill.CharacterObject.Options.KarmaSpecialization); if (!parrent.ConfirmKarmaExpense(confirmstring)) { return; } } frmSelectSpec selectForm = new frmSelectSpec(skill); selectForm.Mode = "Knowledge"; selectForm.ShowDialog(); if (selectForm.DialogResult != DialogResult.OK) { return; } skill.AddSpecialization(selectForm.SelectedItem); //TODO turn this into a databinding, but i don't care enough right now lblSpec.Text = string.Join(", ", (from specialization in skill.Specializations select specialization.Name)); parrent?.UpdateCharacterInfo(); }
private void btnAddSpec_Click(object sender, EventArgs e) { frmCareer parrent = ParentForm as frmCareer; if (parrent != null) { int price = _skill.CharacterObject.Options.KarmaKnowledgeSpecialization; int intExtraSpecCost = 0; int intTotalBaseRating = _skill.TotalBaseRating; decimal decSpecCostMultiplier = 1.0m; foreach (Improvement objLoopImprovement in _skill.CharacterObject.Improvements) { if (objLoopImprovement.Minimum <= intTotalBaseRating && (string.IsNullOrEmpty(objLoopImprovement.Condition) || (objLoopImprovement.Condition == "career") == _skill.CharacterObject.Created || (objLoopImprovement.Condition == "create") != _skill.CharacterObject.Created) && objLoopImprovement.Enabled) { if (objLoopImprovement.ImprovedName == _skill.SkillCategory) { if (objLoopImprovement.ImproveType == Improvement.ImprovementType.SkillCategorySpecializationKarmaCost) { intExtraSpecCost += objLoopImprovement.Value; } else if (objLoopImprovement.ImproveType == Improvement.ImprovementType.SkillCategorySpecializationKarmaCostMultiplier) { decSpecCostMultiplier *= objLoopImprovement.Value / 100.0m; } } } } if (decSpecCostMultiplier != 1.0m) { price = decimal.ToInt32(decimal.Ceiling(price * decSpecCostMultiplier)); } price += intExtraSpecCost; //Spec string confirmstring = string.Format(LanguageManager.GetString("Message_ConfirmKarmaExpenseSkillSpecialization"), price.ToString()); if (!parrent.ConfirmKarmaExpense(confirmstring)) { return; } } frmSelectSpec selectForm = new frmSelectSpec(_skill); selectForm.Mode = "Knowledge"; selectForm.ShowDialog(); if (selectForm.DialogResult != DialogResult.OK) { return; } _skill.AddSpecialization(selectForm.SelectedItem); //TODO turn this into a databinding, but i don't care enough right now lblSpec.Text = string.Join(", ", _skill.Specializations.Select(x => x.Name)); parrent?.ScheduleCharacterUpdate(); }
private void btnAddSpec_Click(object sender, EventArgs e) { int price = _skill.CharacterObject.Options.KarmaKnowledgeSpecialization; int intExtraSpecCost = 0; int intTotalBaseRating = _skill.TotalBaseRating; decimal decSpecCostMultiplier = 1.0m; foreach (Improvement objLoopImprovement in _skill.CharacterObject.Improvements) { if (objLoopImprovement.Minimum <= intTotalBaseRating && (string.IsNullOrEmpty(objLoopImprovement.Condition) || (objLoopImprovement.Condition == "career") == _skill.CharacterObject.Created || (objLoopImprovement.Condition == "create") != _skill.CharacterObject.Created) && objLoopImprovement.Enabled) { if (objLoopImprovement.ImprovedName == _skill.SkillCategory) { if (objLoopImprovement.ImproveType == Improvement.ImprovementType.SkillCategorySpecializationKarmaCost) { intExtraSpecCost += objLoopImprovement.Value; } else if (objLoopImprovement.ImproveType == Improvement.ImprovementType.SkillCategorySpecializationKarmaCostMultiplier) { decSpecCostMultiplier *= objLoopImprovement.Value / 100.0m; } } } } if (decSpecCostMultiplier != 1.0m) { price = decimal.ToInt32(decimal.Ceiling(price * decSpecCostMultiplier)); } price += intExtraSpecCost; //Spec string confirmstring = string.Format(GlobalOptions.CultureInfo, LanguageManager.GetString("Message_ConfirmKarmaExpenseSkillSpecialization"), price); if (!_skill.CharacterObject.ConfirmKarmaExpense(confirmstring)) { return; } using (frmSelectSpec selectForm = new frmSelectSpec(_skill) { Mode = "Knowledge" }) { selectForm.ShowDialog(); if (selectForm.DialogResult != DialogResult.OK) { return; } _skill.AddSpecialization(selectForm.SelectedItem); } if (ParentForm is CharacterShared frmParent) { frmParent.IsCharacterUpdateRequested = true; } }
private async void btnAddSpec_Click(object sender, EventArgs e) { int price = _objSkill.CharacterObject.Settings.KarmaKnowledgeSpecialization; decimal decExtraSpecCost = 0; int intTotalBaseRating = _objSkill.TotalBaseRating; decimal decSpecCostMultiplier = 1.0m; foreach (Improvement objLoopImprovement in _objSkill.CharacterObject.Improvements) { if (objLoopImprovement.Minimum <= intTotalBaseRating && (string.IsNullOrEmpty(objLoopImprovement.Condition) || (objLoopImprovement.Condition == "career") == _objSkill.CharacterObject.Created || (objLoopImprovement.Condition == "create") != _objSkill.CharacterObject.Created) && objLoopImprovement.Enabled && objLoopImprovement.ImprovedName == _objSkill.SkillCategory) { switch (objLoopImprovement.ImproveType) { case Improvement.ImprovementType.SkillCategorySpecializationKarmaCost: decExtraSpecCost += objLoopImprovement.Value; break; case Improvement.ImprovementType.SkillCategorySpecializationKarmaCostMultiplier: decSpecCostMultiplier *= objLoopImprovement.Value / 100.0m; break; } } } if (decSpecCostMultiplier != 1.0m) { price = (price * decSpecCostMultiplier + decExtraSpecCost).StandardRound(); } else { price += decExtraSpecCost.StandardRound(); //Spec } string confirmstring = string.Format(GlobalSettings.CultureInfo, await LanguageManager.GetStringAsync("Message_ConfirmKarmaExpenseSkillSpecialization"), price); if (!CommonFunctions.ConfirmKarmaExpense(confirmstring)) { return; } using (ThreadSafeForm <SelectSpec> selectForm = await ThreadSafeForm <SelectSpec> .GetAsync(() => new SelectSpec(_objSkill) { Mode = "Knowledge" })) { if (await selectForm.ShowDialogSafeAsync(_objSkill.CharacterObject) != DialogResult.OK) { return; } _objSkill.AddSpecialization(selectForm.MyForm.SelectedItem); } }