Example #1
0
        public void LoadTalentSpecs(TalentPicker picker)
        {
            List <ComparisonCalculationBase> talentCalculations = new List <ComparisonCalculationBase>();

            if (Character != null)
            {
                Character baseChar = Character.Clone();
                switch (baseChar.Class)
                {
                case CharacterClass.Warrior: baseChar.WarriorTalents = new WarriorTalents(); break;

                case CharacterClass.Paladin: baseChar.PaladinTalents = new PaladinTalents(); break;

                case CharacterClass.Hunter: baseChar.HunterTalents = new HunterTalents(); break;

                case CharacterClass.Rogue: baseChar.RogueTalents = new RogueTalents(); break;

                case CharacterClass.Priest: baseChar.PriestTalents = new PriestTalents(); break;

                case CharacterClass.Shaman: baseChar.ShamanTalents = new ShamanTalents(); break;

                case CharacterClass.Mage: baseChar.MageTalents = new MageTalents(); break;

                case CharacterClass.Warlock: baseChar.WarlockTalents = new WarlockTalents(); break;

                case CharacterClass.Druid: baseChar.DruidTalents = new DruidTalents(); break;

                case CharacterClass.DeathKnight: baseChar.DeathKnightTalents = new DeathKnightTalents(); break;

                default: baseChar.DruidTalents = new DruidTalents(); break;
                }
                CharacterCalculationsBase baseCalc = Calculations.GetCharacterCalculations(baseChar, null, false, true, false);

                ComparisonCalculationBase compare;
                Character newChar;
                foreach (SavedTalentSpec spec in picker.SpecsFor(Character.Class))
                {
                    newChar = Character.Clone();
                    newChar.CurrentTalents = spec.TalentSpec();
                    compare      = Calculations.GetCharacterComparisonCalculations(baseCalc, newChar, spec.ToString(), spec == picker.CurrentSpec());
                    compare.Item = null;
                    talentCalculations.Add(compare);
                }
            }

            comparisonGraph1.RoundValues      = true;
            comparisonGraph1.CustomRendered   = false;
            comparisonGraph1.ItemCalculations = talentCalculations.ToArray();
            comparisonGraph1.EquipSlot        = CharacterSlot.None;
            _characterSlot = CharacterSlot.None;
        }
Example #2
0
        public void LoadGlyphs()
        {
            List <ComparisonCalculationBase> glyphCalculations = new List <ComparisonCalculationBase>();
            Character baseChar = Character.Clone();
            Character newChar  = Character.Clone();
            CharacterCalculationsBase currentCalc;
            CharacterCalculationsBase newCalc;
            ComparisonCalculationBase compare;
            bool          orig;
            List <string> relevant = Calculations.GetModel(Character.CurrentModel).GetRelevantGlyphs();

            currentCalc = Calculations.GetCharacterCalculations(baseChar, null, false, true, false);
            foreach (PropertyInfo pi in baseChar.CurrentTalents.GetType().GetProperties())
            {
                GlyphDataAttribute[] glyphDatas = pi.GetCustomAttributes(typeof(GlyphDataAttribute), true) as GlyphDataAttribute[];
                if (glyphDatas.Length > 0)
                {
                    GlyphDataAttribute glyphData = glyphDatas[0];
                    if (relevant == null || relevant.Contains(glyphData.Name))
                    {
                        orig = baseChar.CurrentTalents.GlyphData[glyphData.Index];
                        if (orig)
                        {
                            newChar.CurrentTalents.GlyphData[glyphData.Index] = false;
                            newCalc = Calculations.GetCharacterCalculations(newChar, null, false, true, false);
                            compare = Calculations.GetCharacterComparisonCalculations(newCalc, currentCalc, glyphData.Name, orig, false);
                        }
                        else
                        {
                            newChar.CurrentTalents.GlyphData[glyphData.Index] = true;
                            newCalc = Calculations.GetCharacterCalculations(newChar, null, false, true, false);
                            compare = Calculations.GetCharacterComparisonCalculations(currentCalc, newCalc, glyphData.Name, orig, false);
                        }
                        compare.Description = glyphData.Description; // JOTHAY: WTB Tooltips that show info on these charts
                        compare.Item        = null;
                        glyphCalculations.Add(compare);
                        newChar.CurrentTalents.GlyphData[glyphData.Index] = orig;
                    }
                }
            }

            comparisonGraph1.RoundValues      = true;
            comparisonGraph1.CustomRendered   = false;
            comparisonGraph1.ItemCalculations = glyphCalculations.ToArray();
            comparisonGraph1.EquipSlot        = CharacterSlot.None;
            _characterSlot = CharacterSlot.None;
        }
Example #3
0
        private void UpdateGraph(object sender, EventArgs e)
        {
            List <ComparisonCalculationBase> compareCalcs = new List <ComparisonCalculationBase>();

            int i = 0;

            foreach (ComparisonSetControl csc in comparisonSets)
            {
                Item item = new Item();
                item.Name    = "Comparison Set #" + ++i;
                item.Quality = ItemQuality.Temp;
                item.Stats   = Calculations.GetItemStats(csc.CompositeCharacter, null) - Calculations.GetItemStats(Character, null);

                ComparisonCalculationBase comp = Calculations.GetCharacterComparisonCalculations(CurrentCalculations, csc.CurrentCalculations, item.Name, false, false);
                comp.Item = item;
                compareCalcs.Add(comp);
            }

            comparisonGraph.ItemCalculations = compareCalcs.ToArray();
        }
Example #4
0
        public void LoadTalents()
        {
            List <ComparisonCalculationBase> talentCalculations = new List <ComparisonCalculationBase>();
            Character baseChar = Character.Clone();
            Character newChar  = Character.Clone();
            CharacterCalculationsBase currentCalc;
            CharacterCalculationsBase newCalc;
            ComparisonCalculationBase compare;

            currentCalc = Calculations.GetCharacterCalculations(baseChar, null, false, true, false);
            foreach (PropertyInfo pi in baseChar.CurrentTalents.GetType().GetProperties())
            {
                TalentDataAttribute[] talentDatas = pi.GetCustomAttributes(typeof(TalentDataAttribute), true) as TalentDataAttribute[];
                int orig = 0;
                if (talentDatas.Length > 0)
                {
                    TalentDataAttribute talentData = talentDatas[0];
                    orig = baseChar.CurrentTalents.Data[talentData.Index];
                    if (talentData.MaxPoints == (int)pi.GetValue(baseChar.CurrentTalents, null))
                    {
                        newChar.CurrentTalents.Data[talentData.Index]--;
                        newCalc = Calculations.GetCharacterCalculations(newChar, null, false, true, false);
                        compare = Calculations.GetCharacterComparisonCalculations(newCalc, currentCalc, talentData.Name, talentData.MaxPoints == orig, orig != 0);
                    }
                    else
                    {
                        newChar.CurrentTalents.Data[talentData.Index]++;
                        newCalc = Calculations.GetCharacterCalculations(newChar, null, false, true, false);
                        compare = Calculations.GetCharacterComparisonCalculations(currentCalc, newCalc, talentData.Name, talentData.MaxPoints == orig, orig != 0);
                    }
                    string text = string.Format("Current Rank {0}/{1}\r\n\r\n", orig, talentData.MaxPoints);
                    if (orig == 0)
                    {
                        // We originally didn't have it, so first rank is next rank
                        text += "Next Rank:\r\n";
                        text += talentData.Description[0];
                    }
                    else if (orig >= talentData.MaxPoints)
                    {
                        // We originally were at max, so there isn't a next rank, just show the capped one
                        text += talentData.Description[talentData.MaxPoints - 1];
                    }
                    else
                    {
                        // We aren't at 0 or MaxPoints originally, so it's just a point in between
                        text += talentData.Description[orig - 1];
                        text += "\r\n\r\nNext Rank:\r\n";
                        text += talentData.Description[orig];
                    }
                    compare.Description = text;
                    compare.Item        = null;
                    talentCalculations.Add(compare);
                    newChar.CurrentTalents.Data[talentData.Index] = orig;
                }
            }
            comparisonGraph1.RoundValues      = true;
            comparisonGraph1.CustomRendered   = false;
            comparisonGraph1.ItemCalculations = talentCalculations.ToArray();
            comparisonGraph1.EquipSlot        = CharacterSlot.None;
            _characterSlot = CharacterSlot.None;
        }