public void LoadCalculationOptions()
 {
     _loadingCalculationOptions = true;
     if (Character.CalculationOptions == null) Character.CalculationOptions = new CalculationOptionsBear();
     calcOpts = Character.CalculationOptions as CalculationOptionsBear;
     // Model Specific Code
     //
     _loadingCalculationOptions = false;
 }
 public void LoadCalculationOptions()
 {
     _loadingCalculationOptions = true;
     if (Character.CalculationOptions == null)
     {
         Character.CalculationOptions = new CalculationOptionsBear();
     }
     calcOpts = Character.CalculationOptions as CalculationOptionsBear;
     // Model Specific Code
     //
     _loadingCalculationOptions = false;
 }
        private void calculationOptionControl_Changed(object sender, EventArgs e)
        {
            if (!_loadingCalculationOptions)
            {
                CalculationOptionsBear calcOpts = Character.CalculationOptions as CalculationOptionsBear;
                calcOpts.TargetLevel            = int.Parse(comboBoxTargetLevel.SelectedItem.ToString());
                calcOpts.ThreatScale            = (float)numericUpDownThreatValue.Value;
                calcOpts.TemporarySurvivalScale = (float)trackBarTemporarySurvivalEffectValue.Value / 100f;
                calcOpts.TargetArmor            = (int)numericUpDownTargetArmor.Value;
                calcOpts.SurvivalSoftCap        = (int)numericUpDownSurvivalSoftCap.Value;
                calcOpts.TargetDamage           = (int)numericUpDownTargetDamage.Value;
                calcOpts.TargetAttackSpeed      = (float)numericUpDownTargetAttackSpeed.Value;

                calcOpts.CustomUseMaul       = checkBoxMaul.Checked;
                calcOpts.CustomUseMangle     = checkBoxMangle.Checked;
                calcOpts.CustomUseSwipe      = checkBoxSwipe.Checked;
                calcOpts.CustomUseFaerieFire = checkBoxFaerieFire.Checked;
                calcOpts.CustomUseLacerate   = checkBoxLacerate.Checked;
                calcOpts.TargetParryHastes   = checkBoxTargetParryHastes.Checked;

                Character.OnCalculationsInvalidated();
            }
        }
        public Stats GetBuffsStats(Character character, CalculationOptionsBear calcOpts)
        {
            //List<Buff> removedBuffs = new List<Buff>();
            //List<Buff> addedBuffs = new List<Buff>();

            //float hasRelevantBuff;

            #region Passive Ability Auto-Fixing
            // Removes the Trueshot Aura Buff and it's equivalents Unleashed Rage and Abomination's Might if you are
            // maintaining it yourself. We are now calculating this internally for better accuracy and to provide
            // value to relevant talents
            /*{
                hasRelevantBuff = character.HunterTalents.TrueshotAura;
                Buff a = Buff.GetBuffByName("Trueshot Aura");
                Buff b = Buff.GetBuffByName("Unleashed Rage");
                Buff c = Buff.GetBuffByName("Abomination's Might");
                if (hasRelevantBuff > 0)
                {
                    if (character.ActiveBuffs.Contains(a)) { character.ActiveBuffs.Remove(a); removedBuffs.Add(a); }
                    if (character.ActiveBuffs.Contains(b)) { character.ActiveBuffs.Remove(b); removedBuffs.Add(b); }
                    if (character.ActiveBuffs.Contains(c)) { character.ActiveBuffs.Remove(c); removedBuffs.Add(c); }
                }
            }*/
            #endregion

            Stats statsBuffs = GetBuffsStats(character.ActiveBuffs, character.SetBonusCount);

            /*foreach (Buff b in removedBuffs) {
                character.ActiveBuffsAdd(b);
            }
            foreach (Buff b in addedBuffs) {
                character.ActiveBuffs.Remove(b);
            }*/

            return statsBuffs;
        }
        protected override void LoadCalculationOptions()
        {
            _loadingCalculationOptions = true;
            if (Character.CalculationOptions == null)
            {
                Character.CalculationOptions = new CalculationOptionsBear();
            }
            //if (!Character.CalculationOptions.ContainsKey("TargetLevel"))
            //    Character.CalculationOptions["TargetLevel"] = "73";
            //if (!Character.CalculationOptions.ContainsKey("ThreatScale"))
            //    Character.CalculationOptions["ThreatScale"] = "1";
            //if (!Character.CalculationOptions.ContainsKey("EnforceMetagemRequirements"))
            //    Character.CalculationOptions["EnforceMetagemRequirements"] = "No";

            CalculationOptionsBear calcOpts = Character.CalculationOptions as CalculationOptionsBear;

            comboBoxTargetLevel.SelectedItem           = calcOpts.TargetLevel.ToString();
            numericUpDownThreatValue.Value             = (decimal)calcOpts.ThreatScale;
            numericUpDownTargetArmor.Value             = (decimal)calcOpts.TargetArmor;
            numericUpDownSurvivalSoftCap.Value         = calcOpts.SurvivalSoftCap;
            numericUpDownTargetDamage.Value            = calcOpts.TargetDamage;
            numericUpDownTargetAttackSpeed.Value       = (decimal)calcOpts.TargetAttackSpeed;
            trackBarTemporarySurvivalEffectValue.Value = (int)(100f * calcOpts.TemporarySurvivalScale);

            checkBoxMaul.Checked              = calcOpts.CustomUseMaul;
            checkBoxMangle.Checked            = calcOpts.CustomUseMangle;
            checkBoxSwipe.Checked             = calcOpts.CustomUseSwipe;
            checkBoxFaerieFire.Checked        = calcOpts.CustomUseFaerieFire;
            checkBoxLacerate.Checked          = calcOpts.CustomUseLacerate;
            checkBoxTargetParryHastes.Checked = calcOpts.TargetParryHastes;

            switch (numericUpDownThreatValue.Value.ToString())
            {
            case "0": comboBoxThreatValue.SelectedIndex = 0; break;

            case "10": comboBoxThreatValue.SelectedIndex = 1; break;

            case "50": comboBoxThreatValue.SelectedIndex = 2; break;

            case "100": comboBoxThreatValue.SelectedIndex = 3; break;

            default: comboBoxThreatValue.SelectedIndex = 4; break;
            }

            switch (numericUpDownTargetDamage.Value.ToString())
            {
            case "30000": comboBoxTargetDamage.SelectedIndex = 0; break;                 //Normal Dungeons

            case "37000": comboBoxTargetDamage.SelectedIndex = 1; break;                 //Heroic Dungeons

            case "40000": comboBoxTargetDamage.SelectedIndex = 2; break;                 //T7 Raids (10)

            case "47000": comboBoxTargetDamage.SelectedIndex = 3; break;                 //T7 Raids (25)

            case "55000": comboBoxTargetDamage.SelectedIndex = 4; break;                 //T8 Raids (10)

            case "75000": comboBoxTargetDamage.SelectedIndex = 5; break;                 //T8 Raids (10, Hard)

            case "71000": comboBoxTargetDamage.SelectedIndex = 6; break;                 //T8 Raids (25)

            case "90000": comboBoxTargetDamage.SelectedIndex = 7; break;                 //T8 Raids (25, Hard)

            case "70000": comboBoxTargetDamage.SelectedIndex = 8; break;                 //T9 Raids (10)

            case "85000": comboBoxTargetDamage.SelectedIndex = 9; break;                 //T9 Raids (10, Heroic)

            case "80000": comboBoxTargetDamage.SelectedIndex = 10; break;                //T9 Raids (25)

            case "95000": comboBoxTargetDamage.SelectedIndex = 11; break;                //T9 Raids (25, Heroic)

            case "92000": comboBoxTargetDamage.SelectedIndex = 12; break;                //T10 Raids (10)

            case "120000": comboBoxTargetDamage.SelectedIndex = 13; break;               //T10 Raids (10, Heroic)

            case "100000": comboBoxTargetDamage.SelectedIndex = 14; break;               //T10 Raids (25)

            case "150000": comboBoxTargetDamage.SelectedIndex = 15; break;               //T10 Raids (25, Heroic)

            case "105000": comboBoxTargetDamage.SelectedIndex = 16; break;               //Lich King (10)

            case "160000": comboBoxTargetDamage.SelectedIndex = 17; break;               //Lich King (10, Heroic)

            case "155000": comboBoxTargetDamage.SelectedIndex = 18; break;               //Lich King (25)

            case "200000": comboBoxTargetDamage.SelectedIndex = 19; break;               //Lich King (25, Heroic)

            default: comboBoxTargetDamage.SelectedIndex = 20; break;                     //Custom...
            }

            switch (numericUpDownSurvivalSoftCap.Value.ToString())
            {
            case "90000": comboBoxSurvivalSoftCap.SelectedIndex = 0; break;                     //Normal Dungeons

            case "110000": comboBoxSurvivalSoftCap.SelectedIndex = 1; break;                    //Heroic Dungeons

            case "120000": comboBoxSurvivalSoftCap.SelectedIndex = 2; break;                    //T7 Raids (10)

            case "140000": comboBoxSurvivalSoftCap.SelectedIndex = 3; break;                    //T7 Raids (25)

            case "170000": comboBoxSurvivalSoftCap.SelectedIndex = 4; break;                    //T8 Raids (10)

            case "195000": comboBoxSurvivalSoftCap.SelectedIndex = 5; break;                    //T8 Raids (10, Hard)

            case "185000": comboBoxSurvivalSoftCap.SelectedIndex = 6; break;                    //T8 Raids (25)

            case "215000": comboBoxSurvivalSoftCap.SelectedIndex = 7; break;                    //T8 Raids (25, Hard)

            case "180000": comboBoxSurvivalSoftCap.SelectedIndex = 8; break;                    //T9 Raids (10)

            case "210000": comboBoxSurvivalSoftCap.SelectedIndex = 9; break;                    //T9 Raids (10, Heroic)

            case "190000": comboBoxSurvivalSoftCap.SelectedIndex = 10; break;                   //T9 Raids (25)

            case "225000": comboBoxSurvivalSoftCap.SelectedIndex = 11; break;                   //T9 Raids (25, Heroic)

            case "300000": comboBoxSurvivalSoftCap.SelectedIndex = 12; break;                   //T10 Raids (10)

            case "355000": comboBoxSurvivalSoftCap.SelectedIndex = 13; break;                   //T10 Raids (10, Heroic)

            case "350000": comboBoxSurvivalSoftCap.SelectedIndex = 14; break;                   //T10 Raids (25)

            case "400000": comboBoxSurvivalSoftCap.SelectedIndex = 15; break;                   //T10 Raids (25, Heroic)

            case "360000": comboBoxSurvivalSoftCap.SelectedIndex = 16; break;                   //Lich King (10)

            case "410000": comboBoxSurvivalSoftCap.SelectedIndex = 17; break;                   //Lich King (10, Heroic)

            case "405000": comboBoxSurvivalSoftCap.SelectedIndex = 18; break;                   //Lich King (25)

            case "500000": comboBoxSurvivalSoftCap.SelectedIndex = 19; break;                   //Lich King (25, Heroic)

            default: comboBoxSurvivalSoftCap.SelectedIndex = 20; break;
            }

            _loadingCalculationOptions = false;
        }