Ejemplo n.º 1
0
        private void chkActiveCommlink_CheckedChanged(object sender, EventArgs e)
        {
            if (_blnSkipRefresh)
                return;

            Gear objSelectedGear = new Gear(_objCharacter);

            // Attempt to locate the selected piece of Gear.
            try
            {
                objSelectedGear = _objFunctions.FindGear(treGear.SelectedNode.Tag.ToString(), _objCharacter.Gear);

                if (objSelectedGear.GetType() != typeof(Commlink))
                    return;

                Commlink objCommlink = (Commlink)objSelectedGear;
                objCommlink.IsActive = chkActiveCommlink.Checked;

                ChangeActiveCommlink(objCommlink);

                RefreshSelectedGear();
                UpdateCharacterInfo();

                _blnIsDirty = true;
                UpdateWindowTitle();
            }
            catch
            {
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Refresh the information for the currently displayed Gear.
        /// </summary>
        public void RefreshSelectedGear()
        {
            bool blnClear = false;
            try
            {
                if (treGear.SelectedNode.Level == 0)
                    blnClear = true;
            }
            catch
            {
                blnClear = true;
            }
            if (blnClear)
            {
                lblGearRating.Text = "";
                lblGearQty.Text = "";
                cmdGearIncreaseQty.Enabled = false;
                cmdGearReduceQty.Enabled = false;
                chkGearEquipped.Text = LanguageManager.Instance.GetString("Checkbox_Equipped");
                chkGearEquipped.Visible = false;
                chkActiveCommlink.Visible = false;
                cmdGearSplitQty.Enabled = false;
                cmdGearMergeQty.Enabled = false;
                cmdGearMoveToVehicle.Enabled = false;
                tabGearMatrixCM.Visible = false;
                return;
            }
            cmdGearIncreaseQty.Enabled = false;
            chkGearHomeNode.Visible = false;

            if (treGear.SelectedNode.Level > 0)
            {
                Gear objGear = new Gear(_objCharacter);
                objGear = _objFunctions.FindGear(treGear.SelectedNode.Tag.ToString(), _objCharacter.Gear);

                lblGearName.Text = objGear.DisplayNameShort;
                lblGearCategory.Text = objGear.DisplayCategory;
                lblGearAvail.Text = objGear.TotalAvail(true);
                try
                {
                    lblGearCost.Text = String.Format("{0:###,###,##0¥}", objGear.TotalCost);
                }
                catch
                {
                    lblGearCost.Text = objGear.Cost;
                }
                lblGearCapacity.Text = objGear.CalculatedCapacity + " (" + objGear.CapacityRemaining.ToString() + " " + LanguageManager.Instance.GetString("String_Remaining") + ")";
                string strBook = _objOptions.LanguageBookShort(objGear.Source);
                string strPage = objGear.Page;
                lblGearSource.Text = strBook + " " + strPage;
                tipTooltip.SetToolTip(lblGearSource, _objOptions.LanguageBookLong(objGear.Source) + " " + LanguageManager.Instance.GetString("String_Page") + " " + objGear.Page);

                _blnSkipRefresh = true;
                if (objGear.DeviceRating > 0)
                {
                    tabGearMatrixCM.Visible = true;
                    foreach (CheckBox objMatrixCM in tabMatrixCM.Controls.OfType<CheckBox>())
                    {
                        if (Convert.ToInt32(objMatrixCM.Tag.ToString()) <= objGear.MatrixCM)
                        {
                            if (Convert.ToInt32(objMatrixCM.Tag.ToString()) <= objGear.MatrixCMFilled)
                                objMatrixCM.Checked = true;
                            else
                                objMatrixCM.Checked = false;

                            objMatrixCM.Visible = true;
                        }
                        else
                        {
                            objMatrixCM.Checked = false;
                            objMatrixCM.Visible = false;
                            objMatrixCM.Text = "";
                        }
                    }
                }
                else
                {
                    tabGearMatrixCM.Visible = false;
                }
                _blnSkipRefresh = false;
                if (objGear.Category == "Ammunition")
                    cmdGearIncreaseQty.Enabled = true;

                if (objGear.GetType() == typeof(Commlink))
                {
                    Commlink objCommlink = (Commlink)objGear;
                    lblGearDeviceRating.Text = objCommlink.TotalDeviceRating.ToString();
                    _blnSkipRefresh = true;
                    chkActiveCommlink.Checked = objCommlink.IsActive;
                    _blnSkipRefresh = false;

                    cboGearOverclocker.Visible = _objCharacter.Overclocker;
                    lblGearOverclocker.Visible = _objCharacter.Overclocker;
                    ArrayList lstOverclocker = new ArrayList();
                    ListItem objAttribute = new ListItem();
                    objAttribute.Value = "None";
                    objAttribute.Name = LanguageManager.Instance.GetString("String_None");
                    lstOverclocker.Add(objAttribute);
                    if (_objCharacter.Overclocker)
                    {
                        objAttribute = new ListItem();
                        objAttribute.Value = "Attack";
                        objAttribute.Name = LanguageManager.Instance.GetString("String_Attack");
                        lstOverclocker.Add(objAttribute);
                        objAttribute = new ListItem();
                        objAttribute.Value = "Sleaze";
                        objAttribute.Name = LanguageManager.Instance.GetString("String_Sleaze");
                        lstOverclocker.Add(objAttribute);
                        objAttribute = new ListItem();
                        objAttribute.Value = "DataProc";
                        objAttribute.Name = LanguageManager.Instance.GetString("String_DataProcessing");
                        lstOverclocker.Add(objAttribute);
                        objAttribute = new ListItem();
                        objAttribute.Value = "Firewall";
                        objAttribute.Name = LanguageManager.Instance.GetString("String_Firewall");
                    }
                    lstOverclocker.Add(objAttribute);
                    cboGearOverclocker.BindingContext = new BindingContext();
                    cboGearOverclocker.DisplayMember = "Name";
                    cboGearOverclocker.ValueMember = "Value";
                    cboGearOverclocker.DataSource = lstOverclocker;
                    cboGearOverclocker.SelectedIndex = 0;

                    List<string> lstASDF = new List<string>() { objCommlink.Attack.ToString(), objCommlink.Sleaze.ToString(), objCommlink.DataProcessing.ToString(), objCommlink.Firewall.ToString() };
                    cboGearAttack.BindingContext = new BindingContext();
                    cboGearAttack.ValueMember = "Value";
                    cboGearAttack.DisplayMember = "Name";
                    cboGearAttack.DataSource = lstASDF;
                    cboGearAttack.SelectedIndex = 0;
                    cboGearAttack.Visible = true;
                    cboGearSleaze.BindingContext = new BindingContext();
                    cboGearSleaze.ValueMember = "Value";
                    cboGearSleaze.DisplayMember = "Name";
                    cboGearSleaze.DataSource = lstASDF;
                    cboGearSleaze.SelectedIndex = 1;
                    cboGearDataProcessing.BindingContext = new BindingContext();
                    cboGearDataProcessing.ValueMember = "Value";
                    cboGearDataProcessing.DisplayMember = "Name";
                    cboGearDataProcessing.DataSource = lstASDF;
                    cboGearDataProcessing.SelectedIndex = 2;
                    cboGearFirewall.BindingContext = new BindingContext();
                    cboGearFirewall.ValueMember = "Value";
                    cboGearFirewall.DisplayMember = "Name";
                    cboGearFirewall.DataSource = lstASDF;
                    cboGearFirewall.SelectedIndex = 3;
                    lblGearDeviceRating.Text = objCommlink.TotalDeviceRating.ToString();
                    cboCyberwareGearOverclocker.Visible = _objCharacter.Overclocker;
                    lblCyberwareGearOverclocker.Visible = _objCharacter.Overclocker;
                    cboGearAttack.Visible = true;
                    cboGearSleaze.Visible = true;
                    cboGearDataProcessing.Visible = true;
                    cboGearFirewall.Visible = true;
                    lblGearDeviceRating.Visible = true;
                    lblGearDeviceRatingLabel.Visible = true;
                    lblGearAttackLabel.Visible = true;
                    lblGearSleazeLabel.Visible = true;
                    lblGearDataProcessingLabel.Visible = true;
                    lblGearFirewallLabel.Visible = true;
                    if (objCommlink.Category != "Commlink Upgrade")
                        chkActiveCommlink.Visible = true;
                    if (_objCharacter.Metatype == "A.I.")
                    {
                        chkGearHomeNode.Visible = true;
                        chkGearHomeNode.Checked = objCommlink.HomeNode;
                    }
                }
                else
                {
                    cboCyberwareGearOverclocker.Visible = _objCharacter.Overclocker;
                    lblCyberwareGearOverclocker.Visible = _objCharacter.Overclocker;
                    lblGearDeviceRating.Text = objGear.DeviceRating.ToString();
                    chkActiveCommlink.Visible = false;
                    cboGearAttack.Visible = false;
                    cboGearSleaze.Visible = false;
                    cboGearDataProcessing.Visible = false;
                    cboGearFirewall.Visible = false;
                    lblGearAttackLabel.Visible = false;
                    lblGearSleazeLabel.Visible = false;
                    lblGearDataProcessingLabel.Visible = false;
                    lblGearFirewallLabel.Visible = false;
                }

                if (objGear.MaxRating > 0)
                    lblGearRating.Text = objGear.Rating.ToString();
                else
                    lblGearRating.Text = "";

                try
                {
                    lblGearQty.Text = objGear.Quantity.ToString();
                }
                catch
                {
                }

                if (treGear.SelectedNode.Level == 1)
                {
                    _blnSkipRefresh = true;
                    lblGearQty.Text = objGear.Quantity.ToString();
                    chkGearEquipped.Visible = true;
                    chkGearEquipped.Checked = objGear.Equipped;

                    _blnSkipRefresh = false;
                }
                else
                {
                    lblGearQty.Text = "1";
                    chkGearEquipped.Visible = true;
                    chkGearEquipped.Checked = objGear.Equipped;

                    // If this is a Program, determine if its parent Gear (if any) is a Commlink. If so, show the Equipped checkbox.
                    if (objGear.IsProgram && _objOptions.CalculateCommlinkResponse)
                    {
                        Gear objParent = new Gear(_objCharacter);
                        objParent = objGear.Parent;
                        if (objParent.Category != string.Empty)
                        {
                            if (objParent.Category == "Commlink" || objParent.Category == "Nexus")
                                chkGearEquipped.Text = LanguageManager.Instance.GetString("Checkbox_SoftwareRunning");
                        }
                    }
                }

                // Show the Weapon Bonus information if it's available.
                if (objGear.WeaponBonus != null)
                {
                    lblGearDamageLabel.Visible = true;
                    lblGearDamage.Visible = true;
                    lblGearAPLabel.Visible = true;
                    lblGearAP.Visible = true;
                    lblGearDamage.Text = objGear.WeaponBonusDamage();
                    lblGearAP.Text = objGear.WeaponBonusAP;
                }
                else
                {
                    lblGearDamageLabel.Visible = false;
                    lblGearDamage.Visible = false;
                    lblGearAPLabel.Visible = false;
                    lblGearAP.Visible = false;
                }

                cmdGearReduceQty.Enabled = true;

                treGear.SelectedNode.Text = objGear.DisplayName;
            }

            // Enable or disable the Split/Merge buttons as needed.
            if (treGear.SelectedNode.Level == 1)
            {
                cmdGearSplitQty.Enabled = true;
                cmdGearMergeQty.Enabled = true;
                if (_objCharacter.Vehicles.Count > 0)
                    cmdGearMoveToVehicle.Enabled = true;
                else
                    cmdGearMoveToVehicle.Enabled = false;
            }
            else
            {
                cmdGearSplitQty.Enabled = false;
                cmdGearMergeQty.Enabled = false;
                cmdGearMoveToVehicle.Enabled = false;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Refresh the information for the currently displayed Gear.
        /// </summary>
        public void RefreshSelectedGear()
        {
            bool blnClear = false;
            try
            {
                if (treGear.SelectedNode.Level == 0)
                    blnClear = true;
            }
            catch
            {
                blnClear = true;
            }
            if (blnClear)
            {
                _blnSkipRefresh = true;
                nudGearRating.Minimum = 0;
                nudGearRating.Maximum = 0;
                nudGearRating.Enabled = false;
                nudGearQty.Enabled = false;
                chkGearEquipped.Text = LanguageManager.Instance.GetString("Checkbox_Equipped");
                chkGearEquipped.Visible = false;
                chkActiveCommlink.Visible = false;
                _blnSkipRefresh = false;
                return;
            }
            chkGearHomeNode.Visible = false;

            if (treGear.SelectedNode.Level > 0)
            {
                Gear objGear = new Gear(_objCharacter);
                objGear = _objFunctions.FindGear(treGear.SelectedNode.Tag.ToString(), _objCharacter.Gear);

                lblGearName.Text = objGear.DisplayNameShort;
                lblGearCategory.Text = objGear.DisplayCategory;
                lblGearAvail.Text = objGear.TotalAvail(true);
                try
                {
                    lblGearCost.Text = String.Format("{0:###,###,##0¥}", objGear.TotalCost);
                }
                catch
                {
                    lblGearCost.Text = objGear.Cost;
                }
                lblGearCapacity.Text = objGear.CalculatedCapacity + " (" + objGear.CapacityRemaining.ToString() + " " + LanguageManager.Instance.GetString("String_Remaining") + ")";
                string strBook = _objOptions.LanguageBookShort(objGear.Source);
                string strPage = objGear.Page;
                lblGearSource.Text = strBook + " " + strPage;
                tipTooltip.SetToolTip(lblGearSource, _objOptions.LanguageBookLong(objGear.Source) + " " + LanguageManager.Instance.GetString("String_Page") + " " + objGear.Page);

                if (objGear.GetType() == typeof(Commlink))
                {
                    Commlink objCommlink = (Commlink)objGear;
                    List<string> objASDF = new List<string>() { objCommlink.Attack.ToString(), objCommlink.Sleaze.ToString(), objCommlink.DataProcessing.ToString(), objCommlink.Firewall.ToString() };

                    cboGearAttack.BindingContext = new BindingContext();
                    cboGearAttack.ValueMember = "Value";
                    cboGearAttack.DisplayMember = "Name";
                    cboGearAttack.DataSource = objASDF;
                    cboGearAttack.SelectedIndex = 0;
                    cboGearAttack.Visible = true;
                    cboGearSleaze.BindingContext = new BindingContext();
                    cboGearSleaze.ValueMember = "Value";
                    cboGearSleaze.DisplayMember = "Name";
                    cboGearSleaze.DataSource = objASDF;
                    cboGearSleaze.SelectedIndex = 1;
                    cboGearDataProcessing.BindingContext = new BindingContext();
                    cboGearDataProcessing.ValueMember = "Value";
                    cboGearDataProcessing.DisplayMember = "Name";
                    cboGearDataProcessing.DataSource = objASDF;
                    cboGearDataProcessing.SelectedIndex = 2;
                    cboGearFirewall.BindingContext = new BindingContext();
                    cboGearFirewall.ValueMember = "Value";
                    cboGearFirewall.DisplayMember = "Name";
                    cboGearFirewall.DataSource = objASDF;
                    cboGearFirewall.SelectedIndex = 3;
                    lblGearDeviceRating.Text = objCommlink.TotalDeviceRating.ToString();

                    lblGearDeviceRating.Visible = true;
                    cboGearAttack.Visible = true;
                    cboGearSleaze.Visible = true;
                    cboGearDataProcessing.Visible = true;
                    cboGearFirewall.Visible = true;
                    lblGearDeviceRatingLabel.Visible = true;
                    lblGearAttackLabel.Visible = true;
                    lblGearSleazeLabel.Visible = true;
                    lblGearDataProcessingLabel.Visible = true;
                    lblGearFirewallLabel.Visible = true;

                    _blnSkipRefresh = true;
                    chkActiveCommlink.Checked = objCommlink.IsActive;
                    _blnSkipRefresh = false;

                    if (objCommlink.Category != "Commlink Upgrade")
                        chkActiveCommlink.Visible = true;

                    if (_objCharacter.Metatype == "A.I.")
                    {
                        chkGearHomeNode.Visible = true;
                        chkGearHomeNode.Checked = objCommlink.HomeNode;
                    }
                }
                else
                {
                    lblGearDeviceRating.Text = objGear.DeviceRating.ToString();
                    chkActiveCommlink.Visible = false;
                    cboGearAttack.Visible = false;
                    cboGearSleaze.Visible = false;
                    cboGearDataProcessing.Visible = false;
                    cboGearFirewall.Visible = false;
                    lblGearAttackLabel.Visible = false;
                    lblGearSleazeLabel.Visible = false;
                    lblGearDataProcessingLabel.Visible = false;
                    lblGearFirewallLabel.Visible = false;
                }

                if (objGear.MaxRating > 0)
                {
                    _blnSkipRefresh = true;
                    if (objGear.MinRating > 0)
                        nudGearRating.Minimum = objGear.MinRating;
                    else if (objGear.MinRating == 0 && objGear.Name.Contains("Credstick,"))
                        nudGearRating.Minimum = 0;
                    else
                        nudGearRating.Minimum = 1;
                    nudGearRating.Maximum = objGear.MaxRating;
                    nudGearRating.Value = objGear.Rating;
                    if (nudGearRating.Minimum == nudGearRating.Maximum)
                        nudGearRating.Enabled = false;
                    else
                        nudGearRating.Enabled = true;
                    _blnSkipRefresh = false;
                }
                else
                {
                    _blnSkipRefresh = true;
                    nudGearRating.Minimum = 0;
                    nudGearRating.Maximum = 0;
                    nudGearRating.Enabled = false;
                    _blnSkipRefresh = false;
                }

                try
                {
                    _blnSkipRefresh = true;
                    //nudGearQty.Minimum = objGear.CostFor;
                    nudGearQty.Increment = objGear.CostFor;
                    nudGearQty.Value = objGear.Quantity;
                    _blnSkipRefresh = false;
                }
                catch
                {
                }

                if (treGear.SelectedNode.Level == 1)
                {
                    _blnSkipRefresh = true;
                    nudGearQty.Enabled = true;
                    nudGearQty.Increment = objGear.CostFor;
                    //nudGearQty.Minimum = objGear.CostFor;
                    chkGearEquipped.Visible = true;
                    chkGearEquipped.Checked = objGear.Equipped;
                    _blnSkipRefresh = false;
                }
                else
                {
                    nudGearQty.Enabled = false;
                    _blnSkipRefresh = true;
                    chkGearEquipped.Visible = true;
                    chkGearEquipped.Checked = objGear.Equipped;

                    // If this is a Program, determine if its parent Gear (if any) is a Commlink. If so, show the Equipped checkbox.
                    if (objGear.IsProgram && _objOptions.CalculateCommlinkResponse)
                    {
                        Gear objParent = new Gear(_objCharacter);
                        objParent = objGear.Parent;
                        if (objParent.Category != string.Empty)
                        {
                            if (objParent.Category == "Commlinks" || objParent.Category == "Cyberdecks" || objParent.Category == "Nexus")
                                chkGearEquipped.Text = LanguageManager.Instance.GetString("Checkbox_SoftwareRunning");
                        }
                    }
                    _blnSkipRefresh = false;
                }

                // Show the Weapon Bonus information if it's available.
                if (objGear.WeaponBonus != null)
                {
                    lblGearDamageLabel.Visible = true;
                    lblGearDamage.Visible = true;
                    lblGearAPLabel.Visible = true;
                    lblGearAP.Visible = true;
                    lblGearDamage.Text = objGear.WeaponBonusDamage();
                    lblGearAP.Text = objGear.WeaponBonusAP;
                }
                else
                {
                    lblGearDamageLabel.Visible = false;
                    lblGearDamage.Visible = false;
                    lblGearAPLabel.Visible = false;
                    lblGearAP.Visible = false;
                }

                treGear.SelectedNode.Text = objGear.DisplayName;
            }
        }
Ejemplo n.º 4
0
        private void chkGearCM_CheckedChanged(object sender, EventArgs e)
        {
            if (_blnSkipRefresh)
                return;

            // Locate the selected Gear.
            TreeNode objGearNode = new TreeNode();
            objGearNode = treGear.SelectedNode;
            if (treGear.SelectedNode.Level > 1)
            {
                while (objGearNode.Level > 1)
                    objGearNode = objGearNode.Parent;
            }

            Gear objGear = new Gear(_objCharacter);
            foreach (Gear objCharacterGear in _objCharacter.Gear)
            {
                if (objCharacterGear.InternalId == objGearNode.Tag.ToString())
                {
                    objGear = objCharacterGear;
                    break;
                }
            }

            int intFillCount = 0;
            CheckBox objCheck = (CheckBox)sender;
            {
                if (objCheck.Checked)
                {
                    // If this is being checked, make sure everything before it is checked off.
                    _blnSkipRefresh = true;
                    foreach (CheckBox objGearCM in tabMatrixCM.Controls.OfType<CheckBox>())
                    {
                        if (Convert.ToInt32(objGearCM.Tag.ToString()) < Convert.ToInt32(objCheck.Tag.ToString()))
                            objGearCM.Checked = true;

                        if (objGearCM.Checked)
                            intFillCount += 1;
                    }
                    _blnSkipRefresh = false;
                }
                else
                {
                    // If this is being unchecked, make sure everything after it is unchecked.
                    _blnSkipRefresh = true;
                    foreach (CheckBox objGearCM in tabMatrixCM.Controls.OfType<CheckBox>())
                    {
                        if (Convert.ToInt32(objGearCM.Tag.ToString()) > Convert.ToInt32(objCheck.Tag.ToString()))
                            objGearCM.Checked = false;

                        if (objGearCM.Checked)
                            intFillCount += 1;
                    }
                    _blnSkipRefresh = false;
                }
                if (objGear.GetType() == typeof(Commlink))
                {
                    Commlink objCommlink = (Commlink)objGear;
                    objCommlink.MatrixCMFilled = intFillCount;
                }
                else
                {
                    objGear.MatrixCMFilled = intFillCount;
                }

                UpdateCharacterInfo();

                _blnIsDirty = true;
                UpdateWindowTitle();
            }
        }