Ejemplo n.º 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.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();
        }
Ejemplo n.º 2
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;
            }
        }
Ejemplo n.º 3
0
        private void btnAddSpec_Click(object sender, EventArgs e)
        {
            frmCareer parrent = ParentForm as frmCareer;

            if (parrent != null)
            {
                int price = _skill.CharacterObject.Options.KarmaSpecialization;

                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", GlobalOptions.Language), price.ToString());

                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(GlobalOptions.Language)));

            parrent?.ScheduleCharacterUpdate();
        }
Ejemplo n.º 4
0
        private async void btnAddSpec_Click(object sender, EventArgs e)
        {
            int price = _objSkill.CharacterObject.Settings.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)
                {
                    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)))
            {
                if (await selectForm.ShowDialogSafeAsync(_objSkill.CharacterObject) != DialogResult.OK)
                {
                    return;
                }
                _objSkill.AddSpecialization(selectForm.MyForm.SelectedItem);
            }
        }