• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Chummer.ExpenseLogEntry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Chummer.ExpenseLogEntry的典型用法代码示例。如果您正苦于以下问题:C# ExpenseLogEntry类的具体用法?C# ExpenseLogEntry怎么用?C# ExpenseLogEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ExpenseLogEntry类属于Chummer命名空间,在下文中一共展示了ExpenseLogEntry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: tsVehicleAddWeaponAccessory_Click


//.........这里部分代码省略.........
                MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotModifyWeapon"), LanguageManager.Instance.GetString("MessageTitle_CannotModifyWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            // Make sure the Weapon allows Accessories to be added to it.
            if (!Convert.ToBoolean(objXmlWeapon["allowaccessory"].InnerText))
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotModifyWeapon"), LanguageManager.Instance.GetString("MessageTitle_CannotModifyWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            else
            {
                XmlNodeList objXmlMountList = objXmlWeapon.SelectNodes("accessorymounts/mount");
                string strMounts = "";
                foreach (XmlNode objXmlMount in objXmlMountList)
                {
                    // Run through the Weapon's currenct Accessories and filter out any used up Mount points.
                    bool blnFound = false;
                    foreach (WeaponAccessory objCurrentAccessory in objWeapon.WeaponAccessories)
                    {
                        if (objCurrentAccessory.Mount == objXmlMount.InnerText)
                            blnFound = true;
                    }
                    if (!blnFound)
                        strMounts += objXmlMount.InnerText + "/";
                }
                frmPickWeaponAccessory.AllowedMounts = strMounts;
            }

            frmPickWeaponAccessory.WeaponCost = objWeapon.Cost;
            frmPickWeaponAccessory.AccessoryMultiplier = objWeapon.AccessoryMultiplier;
            frmPickWeaponAccessory.ShowDialog();

            if (frmPickWeaponAccessory.DialogResult == DialogResult.Cancel)
                return;

            // Locate the selected piece.
            objXmlWeapon = objXmlDocument.SelectSingleNode("/chummer/accessories/accessory[name = \"" + frmPickWeaponAccessory.SelectedAccessory + "\"]");

            TreeNode objNode = new TreeNode();
            WeaponAccessory objAccessory = new WeaponAccessory(_objCharacter);
            objAccessory.Create(objXmlWeapon, objNode, frmPickWeaponAccessory.SelectedMount);
            objAccessory.Parent = objWeapon;

            // Check the item's Cost and make sure the character can afford it.
            int intOriginalCost = objWeapon.TotalCost;
            objWeapon.WeaponAccessories.Add(objAccessory);

            int intCost = objWeapon.TotalCost - intOriginalCost;
            // Apply a markup if applicable.
            if (frmPickWeaponAccessory.Markup != 0)
            {
                double dblCost = Convert.ToDouble(intCost, GlobalOptions.Instance.CultureInfo);
                dblCost *= 1 + (Convert.ToDouble(frmPickWeaponAccessory.Markup, GlobalOptions.Instance.CultureInfo) / 100.0);
                intCost = Convert.ToInt32(dblCost);
            }

            // Multiply the cost if applicable.
            if (objAccessory.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailRestricted")) && _objOptions.MultiplyRestrictedCost)
                intCost *= _objOptions.RestrictedCostMultiplier;
            if (objAccessory.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailForbidden")) && _objOptions.MultiplyForbiddenCost)
                intCost *= _objOptions.ForbiddenCostMultiplier;

            if (!frmPickWeaponAccessory.FreeCost)
            {
                if (intCost > _objCharacter.Nuyen)
                {
                    objWeapon.WeaponAccessories.Remove(objAccessory);
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (frmPickWeaponAccessory.AddAgain)
                        tsVehicleAddWeaponAccessory_Click(sender, e);

                    return;
                }
                else
                {
                    // Create the Expense Log Entry.
                    ExpenseLogEntry objExpense = new ExpenseLogEntry();
                    objExpense.Create(intCost * -1, LanguageManager.Instance.GetString("String_ExpensePurchaseVehicleWeaponAccessory") + " " + objAccessory.DisplayNameShort, ExpenseType.Nuyen, DateTime.Now);
                    _objCharacter.ExpenseEntries.Add(objExpense);
                    _objCharacter.Nuyen -= intCost;

                    ExpenseUndo objUndo = new ExpenseUndo();
                    objUndo.CreateNuyen(NuyenExpenseType.AddVehicleWeaponAccessory, objAccessory.InternalId);
                    objExpense.Undo = objUndo;
                }
            }

            objNode.ContextMenuStrip = cmsVehicleWeaponAccessory;
            treVehicles.SelectedNode.Nodes.Add(objNode);
            treVehicles.SelectedNode.Expand();

            if (frmPickWeaponAccessory.AddAgain)
                tsVehicleAddWeaponAccessory_Click(sender, e);

            UpdateCharacterInfo();

            _blnIsDirty = true;
            UpdateWindowTitle();
        }
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs


示例2: cmdChangeSpec_Click

        private void cmdChangeSpec_Click(object sender, EventArgs e)
        {
            if (_objSkill.CharacterObject.Karma < _objSkill.CharacterObject.Options.KarmaSpecialization)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            XmlDocument objXmlDocument = new XmlDocument();
            objXmlDocument = XmlManager.Instance.Load("skills.xml");

            // When the selected Knowledge Skill is changed, check the Skill file and build the pre-defined list of its Specializations (if any).
            List<ListItem> lstSpecializations = new List<ListItem>();
            XmlNode objXmlSkill;
            if (_objSkill.KnowledgeSkill)
            {
                objXmlSkill = objXmlDocument.SelectSingleNode("/chummer/knowledgeskills/skill[name = \"" + _objSkill.Name + "\"]");
                if (objXmlSkill == null)
                    objXmlSkill = objXmlDocument.SelectSingleNode("/chummer/knowledgeskills/skill[translate = \"" + _objSkill.Name + "\"]");
            }
            else
            {
                objXmlSkill = objXmlDocument.SelectSingleNode("/chummer/skills/skill[name = \"" + _objSkill.Name + "\"]");
                if (objXmlSkill == null)
                    objXmlSkill = objXmlDocument.SelectSingleNode("/chummer/skills/skill[translate = \"" + _objSkill.Name + "\"]");
            }
            if (objXmlSkill != null)
            {
                if (!_blnSkipRefresh)
                    cboKnowledgeSkillCategory.SelectedValue = objXmlSkill["category"].InnerText;
                cboSpec.Items.Clear();
                foreach (XmlNode objXmlSpecialization in objXmlSkill.SelectNodes("specs/spec"))
                {
                    bool blnFound = false;
                    foreach(SkillSpecialization objSpecialization in _objSkill.Specializations)
                    {
                        if (objSpecialization.Name == objXmlSpecialization.InnerText)
                        {
                            blnFound = true;
                            break;
                        }
                    }
                    if (!blnFound)
                    {
                        ListItem objItem = new ListItem();
                        if (objXmlSpecialization["translate"] != null)
                            objItem.Name = objXmlSpecialization["translate"].InnerText;
                        else
                            objItem.Name = objXmlSpecialization.InnerText;
                        objItem.Value = objItem.Name;
                        lstSpecializations.Add(objItem);
                    }
                }
            }

            if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseSkillSpecialization").Replace("{0}", _objSkill.CharacterObject.Options.KarmaSpecialization.ToString())))
                return;

            frmSelectItem frmPickItem = new frmSelectItem();
            frmPickItem.DropdownItems = lstSpecializations;
            frmPickItem.ShowDialog();

            if (frmPickItem.DialogResult == DialogResult.Cancel)
            {
                return;
            }

            string strSelectedValue = frmPickItem.SelectedItem;

            // charge the karma and add the spec
            SkillSpecialization objSpec = new SkillSpecialization(strSelectedValue);
            _objSkill.Specializations.Add(objSpec);

            // Create the Expense Log Entry.
            ExpenseLogEntry objEntry = new ExpenseLogEntry();
            objEntry.Create(_objSkill.CharacterObject.Options.KarmaSpecialization * -1, LanguageManager.Instance.GetString("String_ExpenseLearnSpecialization") + " " + _objSkill.Name + " (" + strSelectedValue + ")", ExpenseType.Karma, DateTime.Now);
            _objSkill.CharacterObject.ExpenseEntries.Add(objEntry);
            _objSkill.CharacterObject.Karma -= _objSkill.CharacterObject.Options.KarmaSpecialization;

            ExpenseUndo objUndo = new ExpenseUndo();
            objUndo.CreateKarma(KarmaExpenseType.AddSpecialization, objSpec.InternalId);
            objEntry.Undo = objUndo;

            lblSpec.Text = _objSkill.Specialization;

            this.Height = lblSpec.Height + 10;

            RatingChanged(this);
        }
开发者ID:ltdouthit,项目名称:chummer5a,代码行数:89,代码来源:SkillControl.cs


示例3: Load


//.........这里部分代码省略.........
            }

            // Enhancements
            objXmlNodeList = objXmlDocument.SelectNodes("/character/enhancements/enhancement");
            foreach (XmlNode objXmlEnhancement in objXmlNodeList)
            {
                Enhancement objEnhancement = new Enhancement(this);
                objEnhancement.Load(objXmlEnhancement);
                _lstEnhancements.Add(objEnhancement);
            }

            // Critter Powers.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/critterpowers/critterpower");
            foreach (XmlNode objXmlPower in objXmlNodeList)
            {
                CritterPower objPower = new CritterPower(this);
                objPower.Load(objXmlPower);
                _lstCritterPowers.Add(objPower);
            }

            // Initiation Grades.
            objXmlNodeList = objXmlDocument.SelectNodes("/character/initiationgrades/initiationgrade");
            foreach (XmlNode objXmlGrade in objXmlNodeList)
            {
                InitiationGrade objGrade = new InitiationGrade(this);
                objGrade.Load(objXmlGrade);
                _lstInitiationGrades.Add(objGrade);
            }

            // Expense Log Entries.
            XmlNodeList objXmlExpenseList = objXmlDocument.SelectNodes("/character/expenses/expense");
            foreach (XmlNode objXmlExpense in objXmlExpenseList)
            {
                ExpenseLogEntry objExpenseLogEntry = new ExpenseLogEntry();
                objExpenseLogEntry.Load(objXmlExpense);
                _lstExpenseLog.Add(objExpenseLogEntry);
            }

            // Locations.
            XmlNodeList objXmlLocationList = objXmlDocument.SelectNodes("/character/locations/location");
            foreach (XmlNode objXmlLocation in objXmlLocationList)
            {
                _lstLocations.Add(objXmlLocation.InnerText);
            }

            // Armor Bundles.
            XmlNodeList objXmlBundleList = objXmlDocument.SelectNodes("/character/armorbundles/armorbundle");
            foreach (XmlNode objXmlBundle in objXmlBundleList)
            {
                _lstArmorBundles.Add(objXmlBundle.InnerText);
            }

            // Weapon Locations.
            XmlNodeList objXmlWeaponLocationList = objXmlDocument.SelectNodes("/character/weaponlocations/weaponlocation");
            foreach (XmlNode objXmlLocation in objXmlWeaponLocationList)
            {
                _lstWeaponLocations.Add(objXmlLocation.InnerText);
            }

            // Improvement Groups.
            XmlNodeList objXmlGroupList = objXmlDocument.SelectNodes("/character/improvementgroups/improvementgroup");
            foreach (XmlNode objXmlGroup in objXmlGroupList)
            {
                _lstImprovementGroups.Add(objXmlGroup.InnerText);
            }
开发者ID:ercflemng,项目名称:chummer5a,代码行数:66,代码来源:clsCharacter.cs


示例4: cmdNuyenGained_Click

        private void cmdNuyenGained_Click(object sender, EventArgs e)
        {
            frmExpense frmNewExpense = new frmExpense();
            frmNewExpense.Mode = ExpenseType.Nuyen;
            frmNewExpense.ShowDialog(this);

            if (frmNewExpense.DialogResult == DialogResult.Cancel)
                return;

            // Create the Expense Log Entry.
            ExpenseLogEntry objEntry = new ExpenseLogEntry();
            objEntry.Create(frmNewExpense.Amount, frmNewExpense.strReason, ExpenseType.Nuyen, frmNewExpense.SelectedDate);
            objEntry.Refund = frmNewExpense.Refund;
            _objCharacter.ExpenseEntries.Add(objEntry);

            ExpenseUndo objUndo = new ExpenseUndo();
            objUndo.CreateNuyen(NuyenExpenseType.ManualAdd, "");
            objEntry.Undo = objUndo;

            // Adjust the character's Nuyen total.
            _objCharacter.Nuyen += frmNewExpense.Amount;

            UpdateCharacterInfo();

            _blnIsDirty = true;
            UpdateWindowTitle();
        }
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:27,代码来源:frmCareer.cs


示例5: cmdQuickenSpell_Click

        private void cmdQuickenSpell_Click(object sender, EventArgs e)
        {
            try
            {
                if (treSpells.SelectedNode.Level != 1)
                    return;
            }
            catch
            {
                return;
            }

            frmSelectNumber frmPickNumber = new frmSelectNumber();
            frmPickNumber.Description = LanguageManager.Instance.GetString("String_QuickeningKarma").Replace("{0}", treSpells.SelectedNode.Text);
            frmPickNumber.Minimum = 1;
            frmPickNumber.ShowDialog(this);

            if (frmPickNumber.DialogResult == DialogResult.Cancel)
                return;

            // Make sure the character has enough Karma to improve the Attribute.
            int intKarmaCost = frmPickNumber.SelectedValue;
            if (intKarmaCost > _objCharacter.Karma)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseQuickeningMetamagic").Replace("{0}", intKarmaCost.ToString()).Replace("{1}", treSpells.SelectedNode.Text)))
                return;

            // Create the Karma expense.
            ExpenseLogEntry objExpense = new ExpenseLogEntry();
            objExpense.Create(intKarmaCost * -1, LanguageManager.Instance.GetString("String_ExpenseQuickenMetamagic") + " " + treSpells.SelectedNode.Text, ExpenseType.Karma, DateTime.Now);
            _objCharacter.ExpenseEntries.Add(objExpense);
            _objCharacter.Karma -= intKarmaCost;

            ExpenseUndo objUndo = new ExpenseUndo();
            objUndo.CreateKarma(KarmaExpenseType.QuickeningMetamagic, "");
            objExpense.Undo = objUndo;

            UpdateCharacterInfo();

            _blnIsDirty = true;
            UpdateWindowTitle();
        }
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:46,代码来源:frmCareer.cs


示例6: cmdImproveRES_Click

        private void cmdImproveRES_Click(object sender, EventArgs e)
        {
            // Make sure the character has enough Karma to improve the Attribute.
            int intKarmaCost = 0;
            if (!_objOptions.SpecialKarmaCostBasedOnShownValue)
                intKarmaCost = (_objCharacter.RES.Value + _objCharacter.RES.AttributeValueModifiers + 1) * _objOptions.KarmaAttribute;
            else
                intKarmaCost = (_objCharacter.RES.Value - _objCharacter.EssencePenalty + 1) * _objOptions.KarmaAttribute;

            if (intKarmaCost > _objCharacter.Karma)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            int intFromValue = 0;
            if (!_objOptions.SpecialKarmaCostBasedOnShownValue)
                intFromValue = _objCharacter.RES.Value + _objCharacter.RES.AttributeValueModifiers;
            else
                intFromValue = _objCharacter.RES.Value - _objCharacter.EssencePenalty;

            if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpense").Replace("{0}", LanguageManager.Instance.GetString("String_AttributeRESShort")).Replace("{1}", (intFromValue + 1).ToString()).Replace("{2}", intKarmaCost.ToString())))
                return;

            // Create the Karma expense.
            ExpenseLogEntry objExpense = new ExpenseLogEntry();
            objExpense.Create(intKarmaCost * -1, LanguageManager.Instance.GetString("String_ExpenseAttribute") + " " + LanguageManager.Instance.GetString("String_AttributeRESShort") + " " + (intFromValue).ToString() + " -> " + (intFromValue + 1).ToString(), ExpenseType.Karma, DateTime.Now);
            _objCharacter.ExpenseEntries.Add(objExpense);
            _objCharacter.Karma -= intKarmaCost;

            ExpenseUndo objUndo = new ExpenseUndo();
            objUndo.CreateKarma(KarmaExpenseType.ImproveAttribute, "RES");
            objExpense.Undo = objUndo;

            _objCharacter.RES.Value += 1;

            UpdateCharacterInfo();

            _blnIsDirty = true;
            UpdateWindowTitle();
        }
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:41,代码来源:frmCareer.cs


示例7: cmdIncreaseLifestyleMonths_Click

        private void cmdIncreaseLifestyleMonths_Click(object sender, EventArgs e)
        {
            try
            {
                if (treLifestyles.SelectedNode == null)
                    return;
            }
            catch
            {
                return;
            }

            // Locate the selected Lifestyle.
            Lifestyle objLifestyle = _objFunctions.FindLifestyle(treLifestyles.SelectedNode.Tag.ToString(), _objCharacter.Lifestyles);
            if (objLifestyle == null)
                return;

            // Create the Expense Log Entry.
            int intAmount = objLifestyle.TotalMonthlyCost;
            if (intAmount > _objCharacter.Nuyen)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            ExpenseLogEntry objExpense = new ExpenseLogEntry();
            objExpense.Create(intAmount * -1, LanguageManager.Instance.GetString("String_ExpenseLifestyle") + " " + objLifestyle.DisplayNameShort, ExpenseType.Nuyen, DateTime.Now);
            _objCharacter.ExpenseEntries.Add(objExpense);
            _objCharacter.Nuyen -= intAmount;

            ExpenseUndo objUndo = new ExpenseUndo();
            objUndo.CreateNuyen(NuyenExpenseType.IncreaseLifestyle, objLifestyle.Name);
            objExpense.Undo = objUndo;

            objLifestyle.Months += 1;
            lblLifestyleMonths.Text = objLifestyle.Months.ToString();

            UpdateCharacterInfo();

            _blnIsDirty = true;
            UpdateWindowTitle();
        }
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:42,代码来源:frmCareer.cs


示例8: chkJoinGroup_CheckedChanged

        private void chkJoinGroup_CheckedChanged(object sender, EventArgs e)
        {
            if (_blnSkipRefresh || _blnLoading)
                return;

            // Joining a Network does not cost Karma for Technomancers, so this only applies to Magicians/Adepts.
            if (_objCharacter.MAGEnabled)
            {
                if (chkJoinGroup.Checked)
                {
                    int intKarmaExpense = _objOptions.KarmaJoinGroup;

                    if (intKarmaExpense > _objCharacter.Karma)
                    {
                        MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                        _blnSkipRefresh = true;
                        chkJoinGroup.Checked = false;
                        _blnSkipRefresh = false;
                        return;
                    }

                    string strMessage = "";
                    string strExpense = "";
                    if (_objCharacter.MAGEnabled)
                    {
                        strMessage = LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseJoinGroup");
                        strExpense = LanguageManager.Instance.GetString("String_ExpenseJoinGroup");
                    }
                    else
                    {
                        strMessage = LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseJoinNetwork");
                        strExpense = LanguageManager.Instance.GetString("String_ExpenseJoinNetwork");
                    }

                    if (!ConfirmKarmaExpense(strMessage.Replace("{0}", intKarmaExpense.ToString())))
                    {
                        _blnSkipRefresh = true;
                        chkJoinGroup.Checked = false;
                        _blnSkipRefresh = false;
                        return;
                    }

                    // Create the Expense Log Entry.
                    ExpenseLogEntry objExpense = new ExpenseLogEntry();
                    objExpense.Create(intKarmaExpense * -1, strExpense, ExpenseType.Karma, DateTime.Now);
                    _objCharacter.ExpenseEntries.Add(objExpense);
                    _objCharacter.Karma -= intKarmaExpense;

                    ExpenseUndo objUndo = new ExpenseUndo();
                    objUndo.CreateKarma(KarmaExpenseType.JoinGroup, "");
                    objExpense.Undo = objUndo;

                    _objCharacter.GroupMember = chkJoinGroup.Checked;
                    UpdateCharacterInfo();
                }
                else
                {
                    int intKarmaExpense = _objOptions.KarmaLeaveGroup;

                    if (intKarmaExpense > _objCharacter.Karma)
                    {
                        MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                        _blnSkipRefresh = true;
                        chkJoinGroup.Checked = true;
                        _blnSkipRefresh = false;
                        return;
                    }

                    string strMessage = "";
                    string strExpense = "";
                    if (_objCharacter.MAGEnabled)
                    {
                        strMessage = LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseLeaveGroup");
                        strExpense = LanguageManager.Instance.GetString("String_ExpenseLeaveGroup");
                    }
                    else
                    {
                        strMessage = LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseLeaveNetwork");
                        strExpense = LanguageManager.Instance.GetString("String_ExpenseLeaveNetwork");
                    }

                    if (!ConfirmKarmaExpense(strMessage.Replace("{0}", intKarmaExpense.ToString())))
                    {
                        _blnSkipRefresh = true;
                        chkJoinGroup.Checked = true;
                        _blnSkipRefresh = false;
                        return;
                    }

                    // Create the Expense Log Entry.
                    ExpenseLogEntry objExpense = new ExpenseLogEntry();
                    objExpense.Create(intKarmaExpense * -1, strExpense, ExpenseType.Karma, DateTime.Now);
                    _objCharacter.ExpenseEntries.Add(objExpense);
                    _objCharacter.Karma -= intKarmaExpense;

                    ExpenseUndo objUndo = new ExpenseUndo();
                    objUndo.CreateKarma(KarmaExpenseType.LeaveGroup, "");
                    objExpense.Undo = objUndo;

                    _objCharacter.GroupMember = chkJoinGroup.Checked;
//.........这里部分代码省略.........
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs


示例9: cmdAddComplexForm_Click

        private void cmdAddComplexForm_Click(object sender, EventArgs e)
        {
            // The number of Complex Forms cannot exceed the character's LOG.
            if (_objCharacter.ComplexForms.Count >= ((_objCharacter.RES.Value * 2) + _objImprovementManager.ValueOf(Improvement.ImprovementType.ComplexFormLimit)))
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_ComplexFormLimitCareer"), LanguageManager.Instance.GetString("MessageTitle_ComplexFormLimit"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            // Let the user select a Program.
            frmSelectProgram frmPickProgram = new frmSelectProgram(_objCharacter);
            frmPickProgram.ShowDialog(this);

            // Make sure the dialogue window was not canceled.
            if (frmPickProgram.DialogResult == DialogResult.Cancel)
                return;

            int intKarmaCost = _objOptions.KarmaNewComplexForm;

            XmlDocument objXmlDocument = XmlManager.Instance.Load("complexforms.xml");

            XmlNode objXmlProgram = objXmlDocument.SelectSingleNode("/chummer/complexforms/complexform[name = \"" + frmPickProgram.SelectedProgram + "\"]");

            // Check for SelectText.
            string strExtra = "";
            if (objXmlProgram["bonus"] != null)
            {
                if (objXmlProgram["bonus"]["selecttext"] != null)
                {
                    frmSelectText frmPickText = new frmSelectText();
                    frmPickText.Description = LanguageManager.Instance.GetString("String_Improvement_SelectText").Replace("{0}", frmPickProgram.SelectedProgram);
                    frmPickText.ShowDialog(this);
                    strExtra = frmPickText.SelectedValue;
                }
            }

            TreeNode objNode = new TreeNode();
            ComplexForm objProgram = new ComplexForm(_objCharacter);
            objProgram.Create(objXmlProgram, _objCharacter, objNode, strExtra);
            if (objProgram.InternalId == Guid.Empty.ToString())
                return;

            _objCharacter.ComplexForms.Add(objProgram);

            // If using the optional rule for costing the same as Spells, change the Karma cost.
            if (_objOptions.AlternateComplexFormCost)
                intKarmaCost = _objOptions.KarmaSpell;

            // Make sure the character has enough Karma before letting them select a Complex Form.
            if (_objCharacter.Karma < intKarmaCost)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughKarma"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughKarma"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                // Remove the Improvements created by the Complex Form.
                _objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.ComplexForm, objProgram.InternalId);
                return;
            }

            if (!ConfirmKarmaExpense(LanguageManager.Instance.GetString("Message_ConfirmKarmaExpenseSpend").Replace("{0}", objProgram.DisplayNameShort).Replace("{1}", intKarmaCost.ToString())))
            {
                // Remove the Improvements created by the Complex Form.
                _objImprovementManager.RemoveImprovements(Improvement.ImprovementSource.ComplexForm, objProgram.InternalId);
                return;
            }

            treComplexForms.Nodes[0].Nodes.Add(objNode);
            treComplexForms.Nodes[0].Expand();

            // Create the Expense Log Entry.
            ExpenseLogEntry objExpense = new ExpenseLogEntry();
            objExpense.Create(intKarmaCost * -1, LanguageManager.Instance.GetString("String_ExpenseLearnComplexForm") + " " + objProgram.DisplayNameShort, ExpenseType.Karma, DateTime.Now);
            _objCharacter.ExpenseEntries.Add(objExpense);
            _objCharacter.Karma -= intKarmaCost;

            ExpenseUndo objUndo = new ExpenseUndo();
            objUndo.CreateKarma(KarmaExpenseType.AddComplexForm, objProgram.InternalId);
            objExpense.Undo = objUndo;

            _objFunctions.SortTree(treComplexForms);
            UpdateCharacterInfo();

            _blnIsDirty = true;
            UpdateWindowTitle();

            if (frmPickProgram.AddAgain)
                cmdAddComplexForm_Click(sender, e);
        }
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:85,代码来源:frmCareer.cs


示例10: tsWeaponAddModification_Click


//.........这里部分代码省略.........
            }

            if (objXmlWeapon["allowmod"] != null)
            {
                if (objXmlWeapon["allowmod"].InnerText == "false")
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotModifyWeaponMod"), LanguageManager.Instance.GetString("MessageTitle_CannotModifyWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            // Set the Weapon properties for the window.
            frmPickVehicleMod.WeaponCost = objWeapon.Cost;
            frmPickVehicleMod.TotalWeaponCost = objWeapon.TotalCost;
            frmPickVehicleMod.ModMultiplier = objWeapon.ModMultiplier;
            frmPickVehicleMod.InputFile = "weapons";

            frmPickVehicleMod.ShowDialog(this);

            // Make sure the dialogue window was not canceled.
            if (frmPickVehicleMod.DialogResult == DialogResult.Cancel)
                return;

            // Locate the selected piece.
            XmlNode objXmlMod = objXmlDocument.SelectSingleNode("/chummer/mods/mod[name = \"" + frmPickVehicleMod.SelectedMod + "\"]");

            TreeNode objNode = new TreeNode();
            WeaponMod objMod = new WeaponMod(_objCharacter);
            objMod.Create(objXmlMod, objNode);
            objMod.Rating = frmPickVehicleMod.SelectedRating;
            objMod.Parent = objWeapon;

            // Do not allow the user to add a new Weapon Mod if the Weapon's Capacity has been reached.
            if (_objOptions.EnforceCapacity && objWeapon.SlotsRemaining - objMod.Slots < 0)
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_CapacityReached"), LanguageManager.Instance.GetString("MessageTitle_CapacityReached"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (frmPickVehicleMod.AddAgain)
                    tsWeaponAddModification_Click(sender, e);
                return;
            }

            // Check the item's Cost and make sure the character can afford it.
            int intOriginalCost = objWeapon.TotalCost;
            objWeapon.WeaponMods.Add(objMod);

            int intCost = objWeapon.TotalCost - intOriginalCost;
            // Apply a markup if applicable.
            if (frmPickVehicleMod.Markup != 0)
            {
                double dblCost = Convert.ToDouble(intCost, GlobalOptions.Instance.CultureInfo);
                dblCost *= 1 + (Convert.ToDouble(frmPickVehicleMod.Markup, GlobalOptions.Instance.CultureInfo) / 100.0);
                intCost = Convert.ToInt32(dblCost);
            }

            // Multiply the cost if applicable.
            if (objMod.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailRestricted")) && _objOptions.MultiplyRestrictedCost)
                intCost *= _objOptions.RestrictedCostMultiplier;
            if (objMod.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailForbidden")) && _objOptions.MultiplyForbiddenCost)
                intCost *= _objOptions.ForbiddenCostMultiplier;

            if (!frmPickVehicleMod.FreeCost)
            {
                if (intCost > _objCharacter.Nuyen)
                {
                    objWeapon.WeaponMods.Remove(objMod);
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (frmPickVehicleMod.AddAgain)
                        tsWeaponAddModification_Click(sender, e);

                    return;
                }
                else
                {
                    // Create the Expense Log Entry.
                    ExpenseLogEntry objExpense = new ExpenseLogEntry();
                    objExpense.Create(intCost * -1, LanguageManager.Instance.GetString("String_ExpensePurchaseWeaponMod") + " " + objMod.DisplayNameShort, ExpenseType.Nuyen, DateTime.Now);
                    _objCharacter.ExpenseEntries.Add(objExpense);
                    _objCharacter.Nuyen -= intCost;

                    ExpenseUndo objUndo = new ExpenseUndo();
                    objUndo.CreateNuyen(NuyenExpenseType.AddWeaponMod, objMod.InternalId);
                    objExpense.Undo = objUndo;
                }
            }

            objNode.Text = objMod.DisplayName;
            objNode.ContextMenuStrip = cmsWeaponMod;

            treWeapons.SelectedNode.Nodes.Add(objNode);
            treWeapons.SelectedNode.Expand();

            UpdateCharacterInfo();
            RefreshSelectedWeapon();

            _blnIsDirty = true;
            UpdateWindowTitle();

            if (frmPickVehicleMod.AddAgain)
                tsWeaponAddModification_Click(sender, e);
        }
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs


示例11: tsWeaponSell_Click

        private void tsWeaponSell_Click(object sender, EventArgs e)
        {
            // Delete the selected Weapon.
            try
            {
                if (treWeapons.SelectedNode.Level == 1)
                {
                    Weapon objWeapon = new Weapon(_objCharacter);
                    // Locate the Weapon that is selected in the tree.
                    foreach (Weapon objCharacterWeapon in _objCharacter.Weapons)
                    {
                        if (objCharacterWeapon.InternalId == treWeapons.SelectedNode.Tag.ToString())
                        {
                            objWeapon = objCharacterWeapon;
                            break;
                        }
                    }

                    // Cyberweapons cannot be removed through here and must be done by removing the piece of Cyberware.
                    if (objWeapon.Cyberware)
                    {
                        MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotRemoveCyberweapon"), LanguageManager.Instance.GetString("MessageTitle_CannotRemoveCyberweapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (objWeapon.Category == "Gear")
                    {
                        MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotRemoveGearWeapon"), LanguageManager.Instance.GetString("MessageTitle_CannotRemoveGearWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    if (objWeapon.Category.StartsWith("Quality"))
                    {
                        MessageBox.Show(LanguageManager.Instance.GetString("Message_CannotRemoveQualityWeapon"), LanguageManager.Instance.GetString("MessageTitle_CannotRemoveQualityWeapon"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }

                    frmSellItem frmSell = new frmSellItem();
                    frmSell.ShowDialog(this);

                    if (frmSell.DialogResult == DialogResult.Cancel)
                        return;

                    // Create the Expense Log Entry for the sale.
                    int intAmount = Convert.ToInt32(Convert.ToDouble(objWeapon.TotalCost, GlobalOptions.Instance.CultureInfo) * frmSell.SellPercent);
                    ExpenseLogEntry objExpense = new ExpenseLogEntry();
                    objExpense.Create(intAmount, LanguageManager.Instance.GetString("String_ExpenseSoldWeapon") + " " + objWeapon.DisplayNameShort, ExpenseType.Nuyen, DateTime.Now);
                    _objCharacter.ExpenseEntries.Add(objExpense);
                    _objCharacter.Nuyen += intAmount;

                    _objCharacter.Weapons.Remove(objWeapon);
                    treWeapons.SelectedNode.Remove();
                }
                else if (treWeapons.SelectedNode.Level > 1)
                {
                    Weapon objWeapon = new Weapon(_objCharacter);
                    // Locate the Weapon that is selected in the tree.
                    foreach (Weapon objCharacterWeapon in _objCharacter.Weapons)
                    {
                        if (objCharacterWeapon.InternalId == treWeapons.SelectedNode.Parent.Tag.ToString())
                        {
                            objWeapon = objCharacterWeapon;
                            break;
                        }
                    }

                    WeaponAccessory objAccessory = new WeaponAccessory(_objCharacter);
                    // Locate the Accessory that is selected in the tree.
                    foreach (WeaponAccessory objCharacterAccessory in objWeapon.WeaponAccessories)
                    {
                        if (objCharacterAccessory.InternalId == treWeapons.SelectedNode.Tag.ToString())
                        {
                            objAccessory = objCharacterAccessory;
                            break;
                        }
                    }

                    if (objAccessory.Name != "")
                    {
                        frmSellItem frmSell = new frmSellItem();
                        frmSell.ShowDialog(this);

                        if (frmSell.DialogResult == DialogResult.Cancel)
                            return;

                        // Record the Weapon's original cost.
                        int intOriginal = objWeapon.TotalCost;

                        objWeapon.WeaponAccessories.Remove(objAccessory);
                        treWeapons.SelectedNode.Remove();

                        int intAmount = Convert.ToInt32(Convert.ToDouble(intOriginal - objWeapon.TotalCost, GlobalOptions.Instance.CultureInfo) * frmSell.SellPercent);
                        ExpenseLogEntry objExpense = new ExpenseLogEntry();
                        objExpense.Create(intAmount, LanguageManager.Instance.GetString("String_ExpenseSoldWeaponAccessory") + " " + objAccessory.DisplayNameShort, ExpenseType.Nuyen, DateTime.Now);
                        _objCharacter.ExpenseEntries.Add(objExpense);
                        _objCharacter.Nuyen += intAmount;
                    }

                    WeaponMod objMod = new WeaponMod(_objCharacter);
                    // Locate the Mod that is selected in the tree.
                    foreach (WeaponMod objCharacterMod in objWeapon.WeaponMods)
                    {
//.........这里部分代码省略.........
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs


示例12: tsWeaponAddAccessory_Click


//.........这里部分代码省略.........
            frmPickWeaponAccessory.WeaponCost = objWeapon.Cost;
            frmPickWeaponAccessory.AccessoryMultiplier = objWeapon.AccessoryMultiplier;
            frmPickWeaponAccessory.ShowDialog();

            if (frmPickWeaponAccessory.DialogResult == DialogResult.Cancel)
                return;

            // Locate the selected piece.
            objXmlWeapon = objXmlDocument.SelectSingleNode("/chummer/accessories/accessory[name = \"" + frmPickWeaponAccessory.SelectedAccessory + "\"]");

            TreeNode objNode = new TreeNode();
            WeaponAccessory objAccessory = new WeaponAccessory(_objCharacter);
            objAccessory.Create(objXmlWeapon, objNode, frmPickWeaponAccessory.SelectedMount);
            objAccessory.Parent = objWeapon;

            if (objAccessory.Cost.StartsWith("Variable"))
            {
                int intMin = 0;
                int intMax = 0;
                string strCost = objAccessory.Cost.Replace("Variable(", string.Empty).Replace(")", string.Empty);
                if (strCost.Contains("-"))
                {
                    string[] strValues = strCost.Split('-');
                    intMin = Convert.ToInt32(strValues[0]);
                    intMax = Convert.ToInt32(strValues[1]);
                }
                else
                    intMin = Convert.ToInt32(strCost.Replace("+", string.Empty));

                if (intMin != 0 || intMax != 0)
                {
                    frmSelectNumber frmPickNumber = new frmSelectNumber();
                    if (intMax == 0)
                        intMax = 1000000;
                    frmPickNumber.Minimum = intMin;
                    frmPickNumber.Maximum = intMax;
                    frmPickNumber.Description = LanguageManager.Instance.GetString("String_SelectVariableCost").Replace("{0}", objAccessory.DisplayNameShort);
                    frmPickNumber.AllowCancel = false;
                    frmPickNumber.ShowDialog();
                    objAccessory.Cost = frmPickNumber.SelectedValue.ToString();
                }
            }

            // Check the item's Cost and make sure the character can afford it.
            int intOriginalCost = objWeapon.TotalCost;
            objWeapon.WeaponAccessories.Add(objAccessory);

            int intCost = objWeapon.TotalCost - intOriginalCost;
            // Apply a markup if applicable.
            if (frmPickWeaponAccessory.Markup != 0)
            {
                double dblCost = Convert.ToDouble(intCost, GlobalOptions.Instance.CultureInfo);
                dblCost *= 1 + (Convert.ToDouble(frmPickWeaponAccessory.Markup, GlobalOptions.Instance.CultureInfo) / 100.0);
                intCost = Convert.ToInt32(dblCost);
            }

            // Multiply the cost if applicable.
            if (objAccessory.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailRestricted")) && _objOptions.MultiplyRestrictedCost)
                intCost *= _objOptions.RestrictedCostMultiplier;
            if (objAccessory.TotalAvail.EndsWith(LanguageManager.Instance.GetString("String_AvailForbidden")) && _objOptions.MultiplyForbiddenCost)
                intCost *= _objOptions.ForbiddenCostMultiplier;

            if (!frmPickWeaponAccessory.FreeCost)
            {
                if (intCost > _objCharacter.Nuyen)
                {
                    objWeapon.WeaponAccessories.Remove(objAccessory);
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (frmPickWeaponAccessory.AddAgain)
                        tsWeaponAddAccessory_Click(sender, e);

                    return;
                }
                else
                {
                    // Create the Expense Log Entry.
                    ExpenseLogEntry objExpense = new ExpenseLogEntry();
                    objExpense.Create(intCost * -1, LanguageManager.Instance.GetString("String_ExpensePurchaseWeaponAccessory") + " " + objAccessory.DisplayNameShort, ExpenseType.Nuyen, DateTime.Now);
                    _objCharacter.ExpenseEntries.Add(objExpense);
                    _objCharacter.Nuyen -= intCost;

                    ExpenseUndo objUndo = new ExpenseUndo();
                    objUndo.CreateNuyen(NuyenExpenseType.AddWeaponAccessory, objAccessory.InternalId);
                    objExpense.Undo = objUndo;
                }
            }

            objNode.ContextMenuStrip = cmsWeaponAccessory;
            treWeapons.SelectedNode.Nodes.Add(objNode);
            treWeapons.SelectedNode.Expand();

            UpdateCharacterInfo();
            RefreshSelectedWeapon();

            _blnIsDirty = true;
            UpdateWindowTitle();

            if (frmPickWeaponAccessory.AddAgain)
                tsWeaponAddAccessory_Click(sender, e);
        }
开发者ID:Althalusdlg,项目名称:chummer5a,代码行数:101,代码来源:frmCareer.cs


示例13: tsWeaponAccessoryGearMenuAddAsPlugin_Click


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Chummer.ExpenseUndo类代码示例发布时间:2022-05-24
下一篇:
C# Chummer.CritterPower类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap