Пример #1
0
        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();
        }
Пример #2
0
        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();
        }
Пример #3
0
        private void btnAddSpec_Click(object sender, EventArgs e)
        {
            frmCareer parrent = ParentForm as frmCareer;

            if (parrent != null)
            {
                string confirmstring = string.Format(LanguageManager.GetString("Message_ConfirmKarmaExpenseSkillSpecialization"),
                                                     _skill.CharacterObject.Options.KarmaSpecialization);

                if (!parrent.ConfirmKarmaExpense(confirmstring))
                {
                    return;
                }
            }

            frmSelectSpec selectForm = new frmSelectSpec(_skill);

            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
            lblCareerSpec.Text = string.Join(", ", _skill.Specializations.Select(x => x.DisplayName));

            parrent?.ScheduleCharacterUpdate();
        }
Пример #4
0
        private void btnAddSpec_Click(object sender, EventArgs e)
        {
            int price = _objSkill.CharacterObject.Options.KarmaSpecialization;

            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)
                {
                    if (objLoopImprovement.ImproveType == Improvement.ImprovementType.SkillCategorySpecializationKarmaCost)
                    {
                        decExtraSpecCost += 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 + decExtraSpecCost));
            }
            else
            {
                price += decimal.ToInt32(decimal.Ceiling(decExtraSpecCost)); //Spec
            }
            string confirmstring = string.Format(GlobalOptions.CultureInfo, LanguageManager.GetString("Message_ConfirmKarmaExpenseSkillSpecialization"), price);

            if (!_objSkill.CharacterObject.ConfirmKarmaExpense(confirmstring))
            {
                return;
            }

            using (frmSelectSpec selectForm = new frmSelectSpec(_objSkill))
            {
                selectForm.ShowDialog(Program.MainForm);

                if (selectForm.DialogResult != DialogResult.OK)
                {
                    return;
                }

                _objSkill.AddSpecialization(selectForm.SelectedItem);
            }

            if (ParentForm is CharacterShared frmParent)
            {
                frmParent.IsCharacterUpdateRequested = true;
            }
        }
Пример #5
0
        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.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
            lblCareerSpec.Text = string.Join(", ",
                    (from specialization in _skill.Specializations
                     select specialization.Name));

            parrent?.UpdateCharacterInfo();
        }