Esempio n. 1
0
        private void cmdImproveATT_Click(object sender, EventArgs e)
        {
            CharacterAttrib attrib = _objCharacter.AttributeSection.GetAttributeByName(AttributeName);
            int             intUpgradeKarmaCost = attrib.UpgradeKarmaCost;

            if (intUpgradeKarmaCost == -1)
            {
                return;                            //TODO: more descriptive
            }
            if (intUpgradeKarmaCost > _objCharacter.Karma)
            {
                MessageBox.Show(LanguageManager.GetString("Message_NotEnoughKarma", GlobalOptions.Language), LanguageManager.GetString("MessageTitle_NotEnoughKarma", GlobalOptions.Language), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            string confirmstring = string.Format(LanguageManager.GetString("Message_ConfirmKarmaExpense", GlobalOptions.Language), attrib.DisplayNameFormatted, attrib.Value + 1, intUpgradeKarmaCost);

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

            attrib.Upgrade();
            ValueChanged?.Invoke(this, e);
        }
Esempio n. 2
0
        private void cmdImproveATT_Click(object sender, EventArgs e)
        {
            if (ParentForm is frmCareer parent)
            {
                int upgradeKarmaCost = attribute.UpgradeKarmaCost();

                if (upgradeKarmaCost == -1)
                {
                    return;                         //TODO: more descriptive
                }
                string confirmstring = string.Format(LanguageManager.GetString("Message_ConfirmKarmaExpense"),
                                                     attribute.DisplayNameFormatted, attribute.Value + 1, upgradeKarmaCost);
                if (upgradeKarmaCost > _objCharacter.Karma)
                {
                    MessageBox.Show(LanguageManager.GetString("Message_NotEnoughKarma"), LanguageManager.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (!parent.ConfirmKarmaExpense(confirmstring))
                {
                    return;
                }
            }
            attribute.Upgrade();
            ValueChanged?.Invoke(this, e);
        }