Example #1
0
        private void tsVehicleAddNexus_Click(object sender, EventArgs e)
        {
            // Make sure a parent items is selected, then open the Select Gear window.
            try
            {
                if (treVehicles.SelectedNode.Level == 0)
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectGearVehicle"), LanguageManager.Instance.GetString("MessageTitle_SelectGearVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            catch
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectGearVehicle"), LanguageManager.Instance.GetString("MessageTitle_SelectGearVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (treVehicles.SelectedNode.Level > 1)
                treVehicles.SelectedNode = treVehicles.SelectedNode.Parent;

            // Attempt to locate the selected Vehicle.
            Vehicle objSelectedVehicle = _objFunctions.FindVehicle(treVehicles.SelectedNode.Tag.ToString(), _objCharacter.Vehicles);

            frmSelectNexus frmPickNexus = new frmSelectNexus(_objCharacter);
            frmPickNexus.ShowDialog(this);

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

            Gear objGear = new Gear(_objCharacter);
            objGear = frmPickNexus.SelectedNexus;

            TreeNode nodNexus = new TreeNode();
            nodNexus.Text = objGear.Name;
            nodNexus.Tag = objGear.InternalId;
            nodNexus.ContextMenuStrip = cmsVehicleGear;

            foreach (Gear objChild in objGear.Children)
            {
                TreeNode nodModule = new TreeNode();
                nodModule.Text = objChild.Name;
                nodModule.Tag = objChild.InternalId;
                nodModule.ContextMenuStrip = cmsVehicleGear;
                nodNexus.Nodes.Add(nodModule);
                nodNexus.Expand();
            }

            treVehicles.SelectedNode.Nodes.Add(nodNexus);
            treVehicles.SelectedNode.Expand();

            objSelectedVehicle.Gear.Add(objGear);

            UpdateCharacterInfo();
            RefreshSelectedVehicle();
        }
Example #2
0
        private void tsVehicleAddNexus_Click(object sender, EventArgs e)
        {
            // Make sure a parent items is selected, then open the Select Gear window.
            try
            {
                if (treVehicles.SelectedNode.Level == 0)
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectGearVehicle"), LanguageManager.Instance.GetString("MessageTitle_SelectGearVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            catch
            {
                MessageBox.Show(LanguageManager.Instance.GetString("Message_SelectGearVehicle"), LanguageManager.Instance.GetString("MessageTitle_SelectGearVehicle"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (treVehicles.SelectedNode.Level > 1)
                treVehicles.SelectedNode = treVehicles.SelectedNode.Parent;

            // Attempt to locate the selected Vehicle.
            Vehicle objSelectedVehicle = _objFunctions.FindVehicle(treVehicles.SelectedNode.Tag.ToString(), _objCharacter.Vehicles);

            frmSelectNexus frmPickNexus = new frmSelectNexus(_objCharacter, true);
            frmPickNexus.ShowDialog(this);

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

            Gear objGear = new Gear(_objCharacter);
            objGear = frmPickNexus.SelectedNexus;

            int intCost = objGear.TotalCost;

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

            // Check the item's Cost and make sure the character can afford it.
            if (!frmPickNexus.FreeCost)
            {
                if (intCost > _objCharacter.Nuyen)
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    // Create the Expense Log Entry.
                    ExpenseLogEntry objExpense = new ExpenseLogEntry();
                    objExpense.Create(intCost * -1, LanguageManager.Instance.GetString("String_ExpensePurchaseVehicleGear") + " " + objGear.DisplayNameShort, ExpenseType.Nuyen, DateTime.Now);
                    _objCharacter.ExpenseEntries.Add(objExpense);
                    _objCharacter.Nuyen -= intCost;

                    ExpenseUndo objUndo = new ExpenseUndo();
                    objUndo.CreateNuyen(NuyenExpenseType.AddVehicleGear, objGear.InternalId, 1);
                    objExpense.Undo = objUndo;
                }
            }

            TreeNode nodNexus = new TreeNode();
            nodNexus.Text = objGear.Name;
            nodNexus.Tag = objGear.InternalId;
            nodNexus.ContextMenuStrip = cmsVehicleGear;

            foreach (Gear objChild in objGear.Children)
            {
                TreeNode nodModule = new TreeNode();
                nodModule.Text = objChild.Name;
                nodModule.Tag = objChild.InternalId;
                nodModule.ContextMenuStrip = cmsVehicleGear;
                nodNexus.Nodes.Add(nodModule);
                nodNexus.Expand();
            }

            treVehicles.SelectedNode.Nodes.Add(nodNexus);
            treVehicles.SelectedNode.Expand();

            objSelectedVehicle.Gear.Add(objGear);

            UpdateCharacterInfo();
            RefreshSelectedVehicle();

            _blnIsDirty = true;
            UpdateWindowTitle();
        }
Example #3
0
        private void tsGearAddNexus_Click(object sender, EventArgs e)
        {
            treGear.SelectedNode = treGear.Nodes[0];

            frmSelectNexus frmPickNexus = new frmSelectNexus(_objCharacter);
            frmPickNexus.ShowDialog(this);

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

            Gear objGear = new Gear(_objCharacter);
            objGear = frmPickNexus.SelectedNexus;

            TreeNode nodNexus = new TreeNode();
            nodNexus.Text = objGear.Name;
            nodNexus.Tag = objGear.InternalId;
            nodNexus.ContextMenuStrip = cmsGear;

            foreach (Gear objChild in objGear.Children)
            {
                TreeNode nodModule = new TreeNode();
                nodModule.Text = objChild.Name;
                nodModule.Tag = objChild.InternalId;
                nodModule.ContextMenuStrip = cmsGear;
                nodNexus.Nodes.Add(nodModule);
                nodNexus.Expand();
            }

            treGear.Nodes[0].Nodes.Add(nodNexus);
            treGear.Nodes[0].Expand();

            _objCharacter.Gear.Add(objGear);

            UpdateCharacterInfo();
        }
Example #4
0
        private void tsGearAddNexus_Click(object sender, EventArgs e)
        {
            treGear.SelectedNode = treGear.Nodes[0];

            frmSelectNexus frmPickNexus = new frmSelectNexus(_objCharacter);
            frmPickNexus.ShowDialog(this);

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

            Gear objGear = new Gear(_objCharacter);
            objGear = frmPickNexus.SelectedNexus;

            int intCost = objGear.TotalCost;

            // Check the item's Cost and make sure the character can afford it.
            if (!frmPickNexus.FreeCost)
            {
                if (intCost > _objCharacter.Nuyen)
                {
                    MessageBox.Show(LanguageManager.Instance.GetString("Message_NotEnoughNuyen"), LanguageManager.Instance.GetString("MessageTitle_NotEnoughNuyen"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    // Create the Expense Log Entry.
                    ExpenseLogEntry objExpense = new ExpenseLogEntry();
                    objExpense.Create(intCost * -1, LanguageManager.Instance.GetString("String_ExpensePurchaseGear") + " " + objGear.DisplayNameShort, ExpenseType.Nuyen, DateTime.Now);
                    _objCharacter.ExpenseEntries.Add(objExpense);
                    _objCharacter.Nuyen -= intCost;

                    ExpenseUndo objUndo = new ExpenseUndo();
                    objUndo.CreateNuyen(NuyenExpenseType.AddGear, objGear.InternalId, 1);
                    objExpense.Undo = objUndo;
                }
            }

            TreeNode nodNexus = new TreeNode();
            nodNexus.Text = objGear.Name;
            nodNexus.Tag = objGear.InternalId;
            nodNexus.ContextMenuStrip = cmsGear;

            foreach (Gear objChild in objGear.Gears)
            {
                TreeNode nodModule = new TreeNode();
                nodModule.Text = objChild.Name;
                nodModule.Tag = objChild.InternalId;
                nodModule.ContextMenuStrip = cmsGear;
                nodNexus.Nodes.Add(nodModule);
                nodNexus.Expand();
            }

            treGear.Nodes[0].Nodes.Add(nodNexus);
            treGear.Nodes[0].Expand();

            _objCharacter.Gear.Add(objGear);

            UpdateCharacterInfo();

            _blnIsDirty = true;
            UpdateWindowTitle();
        }