Exemplo n.º 1
0
        private void GetItemCalculations(object item)
        {
            //Trace.WriteLine("Starting Calculation for: " + item.ToString());
            ComparisonCalculationBase result = Calculations.GetItemCalculations((Item)item, Character, _characterSlot);

            _itemCalculations[Interlocked.Increment(ref _calculationCount) - 1] = result;
            if (_calculationCount == _itemCalculations.Length)
            {
                _autoResetEvent.Set();
            }
            //Trace.WriteLine("Finished Calculation for: " + item.ToString());
        }
Exemplo n.º 2
0
 protected int CompareItemCalculations(ComparisonCalculationBase a, ComparisonCalculationBase b)
 {
     if (Sort == ComparisonGraph.ComparisonSort.Overall)
     {
         return(a.OverallPoints.CompareTo(b.OverallPoints));
     }
     else if (Sort == ComparisonGraph.ComparisonSort.Alphabetical)
     {
         return(b.Name.CompareTo(a.Name));
     }
     else
     {
         return(a.SubPoints[(int)Sort].CompareTo(b.SubPoints[(int)Sort]));
     }
 }
Exemplo n.º 3
0
        public virtual List <ComparisonCalculationBase> GetEnchantCalculations(Item.ItemSlot slot, Character character, CharacterCalculationsBase currentCalcs)
        {
            ClearCache();
            List <ComparisonCalculationBase> enchantCalcs    = new List <ComparisonCalculationBase>();
            CharacterCalculationsBase        calcsEquipped   = null;
            CharacterCalculationsBase        calcsUnequipped = null;

            foreach (Enchant enchant in Enchant.FindEnchants(slot))
            {
                //if (enchantCalcs.ContainsKey(enchant.Id)) continue;

                bool isEquipped = character.GetEnchantBySlot(enchant.Slot) == enchant;
                if (isEquipped)
                {
                    calcsEquipped = currentCalcs;
                    Character charUnequipped = character.Clone();
                    charUnequipped.SetEnchantBySlot(enchant.Slot, null);
                    calcsUnequipped = GetCharacterCalculations(charUnequipped);
                }
                else
                {
                    Character charUnequipped = character.Clone();
                    Character charEquipped   = character.Clone();
                    charUnequipped.SetEnchantBySlot(enchant.Slot, null);
                    charEquipped.SetEnchantBySlot(enchant.Slot, enchant);
                    calcsUnequipped = GetCharacterCalculations(charUnequipped);
                    calcsEquipped   = GetCharacterCalculations(charEquipped);
                }
                ComparisonCalculationBase enchantCalc = CreateNewComparisonCalculation();
                enchantCalc.Name = enchant.Name;
                enchantCalc.Item = new Item(enchant.Name, Item.ItemQuality.Temp, Item.ItemType.None,
                                            -1 * (enchant.Id + (10000 * (int)enchant.Slot)), null, Item.ItemSlot.None, null, false, enchant.Stats, new Sockets(), 0, 0, 0, 0, 0,
                                            Item.ItemDamageType.Physical, 0, null);
                enchantCalc.Item.Name     = enchant.Name;
                enchantCalc.Item.Stats    = enchant.Stats;
                enchantCalc.Equipped      = isEquipped;
                enchantCalc.OverallPoints = calcsEquipped.OverallPoints - calcsUnequipped.OverallPoints;
                float[] subPoints = new float[calcsEquipped.SubPoints.Length];
                for (int i = 0; i < calcsEquipped.SubPoints.Length; i++)
                {
                    subPoints[i] = calcsEquipped.SubPoints[i] - calcsUnequipped.SubPoints[i];
                }
                enchantCalc.SubPoints = subPoints;
                enchantCalcs.Add(enchantCalc);
            }
            return(enchantCalcs);
        }
Exemplo n.º 4
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();
        }
Exemplo n.º 5
0
 private static float GetCalculationValue(ComparisonCalculationBase calcs, string calculation)
 {
     if (calculation == null || calculation == "Overall Rating")
     {
         return(calcs.OverallPoints);
     }
     else
     {
         int index = 0;
         foreach (string subPoint in Calculations.SubPointNameColors.Keys)
         {
             if (calculation.StartsWith(subPoint, StringComparison.Ordinal))
             {
                 return(calcs.SubPoints[index]);
             }
             index++;
         }
         return(0f);
     }
 }
Exemplo n.º 6
0
        private void RebuildItemList()
        {
            if (this.InvokeRequired)
            {
                Invoke((MethodInvoker)RebuildItemList);
                //InvokeHelper.Invoke(this, "RebuildItemList", null);
                return;
            }
            panelItems.SuspendLayout();

            ////Replaced this...
            //while (panelItems.Controls.Count < this.ItemCalculations.Length)
            //	panelItems.Controls.Add(new ItemSelectorItem());
            //while (panelItems.Controls.Count > this.ItemCalculations.Length)
            //	panelItems.Controls.RemoveAt(panelItems.Controls.Count - 1);

            ////...with this, so as not to constantly create and remove lots of controls
            int currentItemLength = panelItems.Controls.Count;
            int targetItemLength  = this.ItemCalculations.Length;

            if (currentItemLength < targetItemLength)
            {
                int itemSelectorsToCreate = targetItemLength - _itemSelectorItems.Count;
                for (int i = 0; i < itemSelectorsToCreate; i++)
                {
                    _itemSelectorItems.Add(new ItemSelectorItem());
                }
                for (int i = currentItemLength; i < targetItemLength; i++)
                {
                    panelItems.Controls.Add(_itemSelectorItems[i]);
                }
            }
            else if (currentItemLength > targetItemLength)
            {
                for (int i = currentItemLength; i > targetItemLength; i--)
                {
                    panelItems.Controls.RemoveAt(i - 1);
                }
            }

            float maxRating = 0;

            for (int i = 0; i < this.ItemCalculations.Length; i++)
            {
                ItemSelectorItem          ctrl = panelItems.Controls[i] as ItemSelectorItem;
                ComparisonCalculationBase calc = this.ItemCalculations[i];
                if (_button != null)
                {
                    calc.Equipped  = (calc.ItemInstance == _button.SelectedItemInstance && calc.Item == _button.SelectedItem) || (calc.Item.Id == 0 && _button.SelectedItem == null);
                    ctrl.IsEnchant = false;
                }
                if (_buttonEnchant != null)
                {
                    calc.Equipped  = Math.Abs(calc.Item.Id % 10000) == _buttonEnchant.SelectedEnchantId;
                    ctrl.IsEnchant = true;
                }
                ctrl.ItemCalculation = calc;
                ctrl.Character       = Character;
                ctrl.CharacterSlot   = _characterSlot;
                ctrl.Sort            = this.Sort;
                ctrl.HideToolTip();
                bool visible = string.IsNullOrEmpty(this.toolStripTextBoxFilter.Text) || calc.Name.ToLower().Contains(this.toolStripTextBoxFilter.Text.ToLower());
                ctrl.Visible = visible;
                if (visible)
                {
                    float calcRating;
                    if (Sort == ComparisonGraph.ComparisonSort.Overall || this.Sort == ComparisonGraph.ComparisonSort.Alphabetical)
                    {
                        calcRating = calc.OverallPoints;
                    }
                    else
                    {
                        calcRating = calc.SubPoints[(int)Sort];
                    }
                    maxRating = Math.Max(maxRating, calcRating);
                }
            }
            panelItems.ResumeLayout(true);
            foreach (ItemSelectorItem ctrl in panelItems.Controls)
            {
                ctrl.MaxRating = maxRating;
            }
        }
Exemplo n.º 7
0
        public void LoadItemsBySlot(CharacterSlot slot)
        {
            if (_characterSlot != slot)
            {
                _characterSlot = slot;
                List <ComparisonCalculationBase> itemCalculations = new List <ComparisonCalculationBase>();
                if ((int)slot >= 0 && (int)slot <= 20)
                {
                    if (this.Character != null)
                    {
                        bool seenEquippedItem = Character[slot] == null;
                        foreach (ItemInstance item in Character.GetRelevantItemInstances(slot))
                        {
                            if (!seenEquippedItem && Character[slot].Equals(item))
                            {
                                seenEquippedItem = true;
                            }
                            if (item.Item.FitsInSlot(slot, Character))
                            {
                                itemCalculations.Add(Calculations.GetItemCalculations(item, this.Character, slot));
                            }
                        }
                        if (!seenEquippedItem)
                        {
                            itemCalculations.Add(Calculations.GetItemCalculations(Character[slot], this.Character, slot));
                        }
                    }
                    ComparisonCalculationBase emptyCalcs = Calculations.CreateNewComparisonCalculation();
                    emptyCalcs.Name            = "Empty";
                    emptyCalcs.Item            = new Item();
                    emptyCalcs.Item.Name       = "Empty";
                    emptyCalcs.ItemInstance    = new ItemInstance();
                    emptyCalcs.ItemInstance.Id = -1;
                    emptyCalcs.Equipped        = this.Character[slot] == null;
                    itemCalculations.Add(emptyCalcs);
                }
                else
                {
                    if (this.Character != null)
                    {
                        bool seenEquippedItem = false;
                        if (_button != null && _button.SelectedItem == null)
                        {
                            seenEquippedItem = true;
                        }
                        foreach (Item item in Character.GetRelevantItems(slot))
                        {
                            if (!seenEquippedItem && _button != null && item.Equals(_button.SelectedItem))
                            {
                                seenEquippedItem = true;
                            }
                            if (item.FitsInSlot(slot, Character))
                            {
                                if (slot == CharacterSlot.Gems)
                                {
                                    AddGemToItemCalculations(itemCalculations, item);
                                }
                                else
                                {
                                    itemCalculations.Add(Calculations.GetItemCalculations(item, this.Character, slot));
                                }
                            }
                        }
                        if (!seenEquippedItem && _button != null && _button.SelectedItem != null)
                        {
                            itemCalculations.Add(Calculations.GetItemCalculations(_button.SelectedItem, this.Character, slot));
                        }
                    }
                    ComparisonCalculationBase emptyCalcs = Calculations.CreateNewComparisonCalculation();
                    emptyCalcs.Name            = "Empty";
                    emptyCalcs.Item            = new Item();
                    emptyCalcs.Item.Name       = "Empty";
                    emptyCalcs.ItemInstance    = new ItemInstance();
                    emptyCalcs.ItemInstance.Id = -1;
                    if (_button != null && _button.SelectedItem != null)
                    {
                        emptyCalcs.Equipped = _button.SelectedItem == null;
                    }
                    else
                    {
                        emptyCalcs.Equipped = false;
                    }
                    itemCalculations.Add(emptyCalcs);
                }
                itemCalculations.Sort(new System.Comparison <ComparisonCalculationBase>(CompareItemCalculations));
                Dictionary <int, int>            countItem = new Dictionary <int, int>();
                List <ComparisonCalculationBase> filteredItemCalculations = new List <ComparisonCalculationBase>();

                for (int i = itemCalculations.Count - 1; i >= 0; i--)
                //foreach (ComparisonCalculationBase itemCalculation in itemCalculations)
                {
                    ComparisonCalculationBase itemCalculation = itemCalculations[i];
                    int itemId = (itemCalculation.ItemInstance == null ? itemCalculation.Item.Id : itemCalculation.ItemInstance.Id);
                    if (!countItem.ContainsKey(itemId))
                    {
                        countItem.Add(itemId, 0);
                    }
                    if (countItem[itemId]++ < Properties.GeneralSettings.Default.CountGemmingsShown ||
                        itemCalculation.Equipped || itemCalculation.ItemInstance.ForceDisplay)
                    {
                        filteredItemCalculations.Add(itemCalculation);
                    }
                }
                ItemCalculations = filteredItemCalculations.ToArray();
            }
        }
Exemplo n.º 8
0
 private static float GetCalculationValue(ComparisonCalculationBase calcs, string calculation)
 {
     if (calculation == null || calculation == "Overall Rating")
         return calcs.OverallPoints;
     else
     {
         int index = 0;
         foreach (string subPoint in Calculations.SubPointNameColors.Keys)
         {
             if (calculation.StartsWith(subPoint, StringComparison.Ordinal))
                 return calcs.SubPoints[index];
             index++;
         }
         return 0f;
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// Direct Upgrades
        /// </summary>
        /// <param name="currentCalculations"></param>
        /// <param name="divideByCost">When true it only includes items with positive cost and shows upgrade value / cost</param>
        public void LoadAvailableGear(CharacterCalculationsBase currentCalculations, bool divideByCost)
        {
            List <ComparisonCalculationBase>     itemCalculations = new List <ComparisonCalculationBase>();
            SortedList <ItemSlot, CharacterSlot> slotMap          = new SortedList <ItemSlot, CharacterSlot>();

            if (Character != null)
            {
                SortedList <string, ItemInstance> items = new SortedList <string, ItemInstance>();

                float Finger1 = (Character[CharacterSlot.Finger1] == null ? 0 : Calculations.GetItemCalculations(
                                     Character[CharacterSlot.Finger1], Character, CharacterSlot.Finger1).OverallPoints);
                float Finger2 = (Character[CharacterSlot.Finger2] == null ? 0 : Calculations.GetItemCalculations(
                                     Character[CharacterSlot.Finger2], Character, CharacterSlot.Finger2).OverallPoints);

                float Trinket1 = (Character[CharacterSlot.Trinket1] == null ? 0 : Calculations.GetItemCalculations(
                                      Character[CharacterSlot.Trinket1], Character, CharacterSlot.Trinket1).OverallPoints);
                float Trinket2 = (Character[CharacterSlot.Trinket2] == null ? 0 : Calculations.GetItemCalculations(
                                      Character[CharacterSlot.Trinket2], Character, CharacterSlot.Trinket2).OverallPoints);

                if (Finger2 < Finger1)
                {
                    slotMap[ItemSlot.Finger] = CharacterSlot.Finger2;
                }

                if (Trinket2 < Trinket1)
                {
                    slotMap[ItemSlot.Trinket] = CharacterSlot.Trinket2;
                }

                float MainHand = (Character[CharacterSlot.MainHand] == null ? 0 : Calculations.GetItemCalculations(
                                      Character[CharacterSlot.MainHand], Character, CharacterSlot.MainHand).OverallPoints);
                float OffHand = (Character[CharacterSlot.OffHand] == null ? 0 : Calculations.GetItemCalculations(
                                     Character[CharacterSlot.OffHand], Character, CharacterSlot.OffHand).OverallPoints);

                if (MainHand > OffHand)
                {
                    slotMap[ItemSlot.OneHand] = CharacterSlot.OffHand;
                }

                foreach (KeyValuePair <ItemSlot, CharacterSlot> kvp in Item.DefaultSlotMap)
                {
                    try
                    {
                        ItemSlot      iSlot = kvp.Key;
                        CharacterSlot slot;

                        if (slotMap.ContainsKey(iSlot))
                        {
                            slot = slotMap[iSlot];
                        }
                        else
                        {
                            slot = kvp.Value;
                        }
                        if (slot != CharacterSlot.None)
                        {
                            ComparisonCalculationBase slotCalc;
                            ItemInstance currentItem = Character[slot];
                            if (currentItem == null)
                            {
                                slotCalc = Calculations.CreateNewComparisonCalculation();
                            }
                            else
                            {
                                slotCalc = Calculations.GetItemCalculations(currentItem, Character, slot);
                            }

                            foreach (ItemInstance item in Character.GetRelevantItemInstances(slot))
                            {
                                if (!items.ContainsKey(item.GemmedId) && (currentItem == null || currentItem.GemmedId != item.GemmedId))
                                {
                                    if (currentItem != null && currentItem.Item.Unique)
                                    {
                                        CharacterSlot otherSlot = CharacterSlot.None;
                                        switch (slot)
                                        {
                                        case CharacterSlot.Finger1:
                                            otherSlot = CharacterSlot.Finger2;
                                            break;

                                        case CharacterSlot.Finger2:
                                            otherSlot = CharacterSlot.Finger1;
                                            break;

                                        case CharacterSlot.Trinket1:
                                            otherSlot = CharacterSlot.Trinket2;
                                            break;

                                        case CharacterSlot.Trinket2:
                                            otherSlot = CharacterSlot.Trinket1;
                                            break;

                                        case CharacterSlot.MainHand:
                                            otherSlot = CharacterSlot.OffHand;
                                            break;

                                        case CharacterSlot.OffHand:
                                            otherSlot = CharacterSlot.MainHand;
                                            break;
                                        }
                                        if (otherSlot != CharacterSlot.None && Character[otherSlot] != null && (Character[otherSlot].Id == item.Id || (item.Item.UniqueId != null && item.Item.UniqueId.Contains(Character[otherSlot].Id))))
                                        {
                                            continue;
                                        }
                                    }

                                    if (!divideByCost || item.Item.Cost > 0.0f)
                                    {
                                        ComparisonCalculationBase itemCalc = Calculations.GetItemCalculations(item, Character, slot);
                                        //bool include = false;
                                        //for (int i = 0; i < itemCalc.SubPoints.Length; i++)
                                        //{
                                        //    itemCalc.SubPoints[i] -= slotCalc.SubPoints[i];
                                        //    include |= itemCalc.SubPoints[i] > 0;
                                        //}
                                        //itemCalc.OverallPoints -= slotCalc.OverallPoints;
                                        //if ( itemCalc.OverallPoints > 0)
                                        //{
                                        //    itemCalculations.Add(itemCalc);
                                        //}

                                        float difference = itemCalc.OverallPoints - slotCalc.OverallPoints;
                                        if (difference > 0)
                                        {
                                            itemCalc.SubPoints = new float[itemCalc.SubPoints.Length];
                                            if (divideByCost)
                                            {
                                                itemCalc.OverallPoints = difference / item.Item.Cost;
                                            }
                                            else
                                            {
                                                itemCalc.OverallPoints = difference;
                                            }
                                            itemCalculations.Add(itemCalc);
                                        }
                                    }

                                    items[item.GemmedId] = item;
                                }
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            comparisonGraph1.RoundValues      = true;
            comparisonGraph1.CustomRendered   = false;
            comparisonGraph1.DisplayMode      = ComparisonGraph.GraphDisplayMode.Overall;
            comparisonGraph1.ItemCalculations = FilterTopXGemmings(itemCalculations);
            comparisonGraph1.EquipSlot        = CharacterSlot.AutoSelect;
            comparisonGraph1.SlotMap          = slotMap;
            _characterSlot = CharacterSlot.None;
        }
Exemplo n.º 10
0
        void _optimizer_EvaluateUpgradeCompleted(object sender, EvaluateUpgradeCompletedEventArgs e)
        {
            switch (currentOperation)
            {
            case AsyncOperation.BuildUpgradeList:
                upgradeListEnumerator.Current.Value += e.UpgradeValue * CurrentBatchCharacter.Weight;
                upgradeListEnumerator.Current.ValueList.Add(e.UpgradeValue);
                if (upgradeListEnumerator.MoveNext())
                {
                    EvaluateUpgradeCurrentBatchCharacter(false);
                }
                else
                {
                    do
                    {
                        batchIndex++;
                    } while (batchIndex < BatchCharacterList.Count && CurrentBatchCharacter.Character == null);
                    if (batchIndex < BatchCharacterList.Count)
                    {
                        upgradeListEnumerator = GetUpgradeListEnumerator();
                        upgradeListEnumerator.MoveNext();
                        EvaluateUpgradeCurrentBatchCharacter(true);
                    }
                    else
                    {
                        currentOperation        = AsyncOperation.None;
                        buttonCancel.Enabled    = false;
                        statusLabel.Text        = "";
                        statusProgressBar.Value = 0;

                        float totalValue = 0f;
                        foreach (BatchCharacter batchCharacter in BatchCharacterList)
                        {
                            if (batchCharacter.Character != null)
                            {
                                totalValue += batchCharacter.Weight;
                            }
                        }

                        Dictionary <Character.CharacterSlot, List <ComparisonCalculationBase> > upgrades = new Dictionary <Character.CharacterSlot, List <ComparisonCalculationBase> >();

                        foreach (var kvp in upgradeList)
                        {
                            Dictionary <int, UpgradeEntry> filtered = new Dictionary <int, UpgradeEntry>();
                            foreach (UpgradeEntry entry in kvp.Value.Values)
                            {
                                UpgradeEntry existingEntry;
                                filtered.TryGetValue(entry.Item.Id, out existingEntry);
                                if (entry.Value > 0 && (existingEntry == null || entry.Value > existingEntry.Value))
                                {
                                    filtered[entry.Item.Id] = entry;
                                }
                            }

                            upgrades[kvp.Key] = new List <ComparisonCalculationBase>();
                            foreach (UpgradeEntry entry in filtered.Values)
                            {
                                ComparisonCalculationBase itemCalc = Calculations.CreateNewComparisonCalculation();
                                itemCalc.Item          = entry.Item;
                                itemCalc.Enchant       = entry.Enchant;
                                itemCalc.Character     = null;
                                itemCalc.Name          = entry.Item.Name;
                                itemCalc.Equipped      = false;
                                itemCalc.OverallPoints = entry.Value / totalValue;
                                itemCalc.SubPoints     = entry.ValueList.ToArray();

                                upgrades[kvp.Key].Add(itemCalc);
                            }
                        }
                        List <string> customSubpoints = new List <string>();
                        foreach (BatchCharacter batchCharacter in BatchCharacterList)
                        {
                            customSubpoints.Add(batchCharacter.Name);
                        }
                        FormUpgradeComparison.Instance.LoadData(formMain.Character, upgrades, customSubpoints.ToArray());
                        FormUpgradeComparison.Instance.Show();
                    }
                }
                break;
            }
        }
Exemplo n.º 11
0
        public void UpdateScalingGraph(Character character, Stats[] statsList, Stats baseStat, bool requiresReferenceCalculations, Color[] colors, int scale, string explanatoryText, string calculation)
        {
            CharacterCalculationsBase baseCalc = Calculations.GetCharacterCalculations(character);

            if (statsList.Length == 0 || statsList.Length > colors.Length)
            {
                return;                                                            // more than 12 elements for the array would run out of colours
            }
            Point[][] points = new Point[statsList.Length][];
            // extract property data for relative stats calculations
            KeyValuePair <PropertyInfo, float>[] properties = new KeyValuePair <PropertyInfo, float> [statsList.Length];
            for (int index = 0; index < statsList.Length; index++)
            {
                var p = statsList[index].Values(x => x > 0);
                foreach (var kvp in p)
                {
                    properties[index] = kvp;
                }
                points[index] = new Point[2 * scale + 1];
            }
            float unit = 1f;
            var   bp   = baseStat.Values(x => x > 0);

            foreach (var kvp in bp)
            {
                unit = kvp.Value;
            }
            Chart.Series.Clear();
            for (int count = -scale; count <= scale; count++)
            {
                Stats newStats = new Stats();
                newStats.Accumulate(baseStat, count);
                Item item = new Item()
                {
                    Stats = newStats
                };
                if (requiresReferenceCalculations)
                {
                    Calculations.GetCharacterCalculations(character, item, true, false, false);
                }
                for (int index = 0; index < statsList.Length; index++)
                {
                    ComparisonCalculationBase currentCalc = CalculationsBase.GetRelativeStatValue(character, properties[index].Key, item, properties[index].Value);
                    float dpsChange = GetCalculationValue(currentCalc, calculation);
                    points[index][count + scale] = new Point(count * unit, dpsChange);
                }
            }
            for (int index = 0; index < statsList.Length; index++)
            {
                Style dataPointStyle = new Style(typeof(LineDataPoint));
                dataPointStyle.Setters.Add(new Setter(DataPoint.TemplateProperty, Resources["InvisibleDataPointTemplate"]));
                dataPointStyle.Setters.Add(new Setter(DataPoint.BackgroundProperty, new SolidColorBrush(colors[index])));
                Chart.Series.Add(new LineSeries()
                {
                    Title                = statsList[index].ToString(),
                    ItemsSource          = points[index],
                    IndependentValuePath = "X",
                    DependentValuePath   = "Y",
                    DataPointStyle       = dataPointStyle,
                });
            }
            Chart.Axes.Clear();
            Chart.Axes.Add(new LinearAxis()
            {
                Orientation   = AxisOrientation.X,
                Title         = "Stat Change",
                ShowGridLines = true,
            });
            Chart.Axes.Add(new LinearAxis()
            {
                Orientation   = AxisOrientation.Y,
                Title         = calculation,
                ShowGridLines = true,
            });
            // restore reference calculation
            if (requiresReferenceCalculations)
            {
                Stats newStats = new Stats();
                Item  item     = new Item()
                {
                    Stats = newStats
                };
                Calculations.GetCharacterCalculations(character, item, true, false, false);
            }
            orgDataDirty = true;
        }
Exemplo n.º 12
0
        public void LoadAvailableGear(CharacterCalculationsBase currentCalculations)
        {
            List <ComparisonCalculationBase> itemCalculations           = new List <ComparisonCalculationBase>();
            SortedList <Item.ItemSlot, Character.CharacterSlot> slotMap = new SortedList <Item.ItemSlot, Character.CharacterSlot>();

            if (Items != null && Character != null)
            {
                SortedList <string, Item> items = new SortedList <string, Item>();

                float Finger1 = (Character[Character.CharacterSlot.Finger1] == null ? 0 : Calculations.GetItemCalculations(
                                     Character[Character.CharacterSlot.Finger1], Character, Character.CharacterSlot.Finger1).OverallPoints);
                float Finger2 = (Character[Character.CharacterSlot.Finger2] == null ? 0 : Calculations.GetItemCalculations(
                                     Character[Character.CharacterSlot.Finger2], Character, Character.CharacterSlot.Finger2).OverallPoints);

                float Trinket1 = (Character[Character.CharacterSlot.Trinket1] == null ? 0 : Calculations.GetItemCalculations(
                                      Character[Character.CharacterSlot.Trinket1], Character, Character.CharacterSlot.Trinket1).OverallPoints);
                float Trinket2 = (Character[Character.CharacterSlot.Trinket2] == null ? 0 : Calculations.GetItemCalculations(
                                      Character[Character.CharacterSlot.Trinket2], Character, Character.CharacterSlot.Trinket2).OverallPoints);

                if (Finger2 < Finger1)
                {
                    slotMap[Item.ItemSlot.Finger] = Character.CharacterSlot.Finger2;
                }

                if (Trinket2 < Trinket1)
                {
                    slotMap[Item.ItemSlot.Trinket] = Character.CharacterSlot.Trinket2;
                }

                float MainHand = (Character[Character.CharacterSlot.MainHand] == null ? 0 : Calculations.GetItemCalculations(
                                      Character[Character.CharacterSlot.MainHand], Character, Character.CharacterSlot.MainHand).OverallPoints);
                float OffHand = (Character[Character.CharacterSlot.OffHand] == null ? 0 : Calculations.GetItemCalculations(
                                     Character[Character.CharacterSlot.OffHand], Character, Character.CharacterSlot.OffHand).OverallPoints);

                if (MainHand > OffHand)
                {
                    slotMap[Item.ItemSlot.OneHand] = Character.CharacterSlot.OffHand;
                }



                foreach (Item relevantItem in ItemCache.RelevantItems)
                {
                    try
                    {
                        Item.ItemSlot           iSlot = relevantItem.Slot;
                        Character.CharacterSlot slot;

                        if (slotMap.ContainsKey(iSlot))
                        {
                            slot = slotMap[iSlot];
                        }
                        else
                        {
                            slot = Item.DefaultSlotMap[iSlot];
                        }
                        if (slot != Character.CharacterSlot.None)
                        {
                            ComparisonCalculationBase slotCalc;
                            Item currentItem = Character[slot];
                            if (currentItem == null)
                            {
                                slotCalc = Calculations.CreateNewComparisonCalculation();
                            }
                            else
                            {
                                slotCalc = Calculations.GetItemCalculations(currentItem, Character, slot);
                            }

                            foreach (Item item in ItemCache.Instance.FindAllItemsById(relevantItem.Id))
                            {
                                if (!items.ContainsKey(item.GemmedId) && (currentItem == null || currentItem.GemmedId != item.GemmedId))
                                {
                                    if (currentItem != null && currentItem.Unique)
                                    {
                                        Character.CharacterSlot otherSlot = Character.CharacterSlot.None;
                                        switch (slot)
                                        {
                                        case Character.CharacterSlot.Finger1:
                                            otherSlot = Character.CharacterSlot.Finger2;
                                            break;

                                        case Character.CharacterSlot.Finger2:
                                            otherSlot = Character.CharacterSlot.Finger1;
                                            break;

                                        case Character.CharacterSlot.Trinket1:
                                            otherSlot = Character.CharacterSlot.Trinket2;
                                            break;

                                        case Character.CharacterSlot.Trinket2:
                                            otherSlot = Character.CharacterSlot.Trinket1;
                                            break;

                                        case Character.CharacterSlot.MainHand:
                                            otherSlot = Character.CharacterSlot.OffHand;
                                            break;

                                        case Character.CharacterSlot.OffHand:
                                            otherSlot = Character.CharacterSlot.MainHand;
                                            break;
                                        }
                                        if (otherSlot != Character.CharacterSlot.None && Character[otherSlot] != null && Character[otherSlot].Id == item.Id)
                                        {
                                            continue;
                                        }
                                    }

                                    ComparisonCalculationBase itemCalc = Calculations.GetItemCalculations(item, Character, slot);
                                    bool include = false;
                                    for (int i = 0; i < itemCalc.SubPoints.Length; i++)
                                    {
                                        itemCalc.SubPoints[i] -= slotCalc.SubPoints[i];
                                        include |= itemCalc.SubPoints[i] > 0;
                                    }
                                    itemCalc.OverallPoints -= slotCalc.OverallPoints;
                                    if (itemCalc.OverallPoints > 0)
                                    {
                                        itemCalculations.Add(itemCalc);
                                    }
                                    items[item.GemmedId] = item;
                                }
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }

            comparisonGraph1.RoundValues      = true;
            comparisonGraph1.CustomRendered   = false;
            comparisonGraph1.DisplayMode      = ComparisonGraph.GraphDisplayMode.Overall;
            comparisonGraph1.ItemCalculations = itemCalculations.ToArray();
            comparisonGraph1.EquipSlot        = Character.CharacterSlot.AutoSelect;
            comparisonGraph1.SlotMap          = slotMap;
        }
Exemplo n.º 13
0
        /*public static void LoadUpgradesFromWowhead(Character character, CharacterSlot slot, bool usePTR, UpgradeCancelCheck cancel)
        {
            if (!string.IsNullOrEmpty(character.Name))
            {
                //WebRequestWrapper.ResetFatalErrorIndicator();
                List<ComparisonCalculationBase> gemCalculations = new List<ComparisonCalculationBase>();
                foreach (Item item in ItemCache.AllItems)
                {
                    if (item.Slot == ItemSlot.Blue || item.Slot == ItemSlot.Green || item.Slot == ItemSlot.Meta
                         || item.Slot == ItemSlot.Orange || item.Slot == ItemSlot.Prismatic || item.Slot == ItemSlot.Purple
                         || item.Slot == ItemSlot.Red || item.Slot == ItemSlot.Yellow)
                    {
                        gemCalculations.Add(Calculations.GetItemCalculations(item, character, item.Slot == ItemSlot.Meta ? CharacterSlot.Metas : CharacterSlot.Gems));
                    }
                }

                ComparisonCalculationBase idealRed = null, idealBlue = null, idealYellow = null, idealMeta = null;
                foreach (ComparisonCalculationBase calc in gemCalculations)
                {
                    if (Item.GemMatchesSlot(calc.Item, ItemSlot.Meta) && (idealMeta == null || idealMeta.OverallPoints < calc.OverallPoints))
                        idealMeta = calc;
                    if (Item.GemMatchesSlot(calc.Item, ItemSlot.Red) && (idealRed == null || idealRed.OverallPoints < calc.OverallPoints))
                        idealRed = calc;
                    if (Item.GemMatchesSlot(calc.Item, ItemSlot.Blue) && (idealBlue == null || idealBlue.OverallPoints < calc.OverallPoints))
                        idealBlue = calc;
                    if (Item.GemMatchesSlot(calc.Item, ItemSlot.Yellow) && (idealYellow == null || idealYellow.OverallPoints < calc.OverallPoints))
                        idealYellow = calc;
                }
                Dictionary<ItemSlot, int> idealGems = new Dictionary<ItemSlot, int>();
                idealGems.Add(ItemSlot.Meta, idealMeta == null ? 0 : idealMeta.Item.Id);
                idealGems.Add(ItemSlot.Red, idealRed == null ? 0 : idealRed.Item.Id);
                idealGems.Add(ItemSlot.Blue, idealBlue == null ? 0 : idealBlue.Item.Id);
                idealGems.Add(ItemSlot.Yellow, idealYellow == null ? 0 : idealYellow.Item.Id);
                idealGems.Add(ItemSlot.None, 0);

                #region status queuing

                if (slot != CharacterSlot.None)
                {
                    StatusMessaging.UpdateStatus(slot.ToString(), "Queued");
                }
                else
                {
                    StatusMessaging.UpdateStatus(CharacterSlot.Head.ToString(), "Queued");
                    StatusMessaging.UpdateStatus(CharacterSlot.Neck.ToString(), "Queued");
                    StatusMessaging.UpdateStatus(CharacterSlot.Shoulders.ToString(), "Queued");
                    StatusMessaging.UpdateStatus(CharacterSlot.Back.ToString(), "Queued");
                    StatusMessaging.UpdateStatus(CharacterSlot.Chest.ToString(), "Queued");
                    StatusMessaging.UpdateStatus(CharacterSlot.Wrist.ToString(), "Queued");
                    StatusMessaging.UpdateStatus(CharacterSlot.Hands.ToString(), "Queued");
                    StatusMessaging.UpdateStatus(CharacterSlot.Waist.ToString(), "Queued");
                    StatusMessaging.UpdateStatus(CharacterSlot.Legs.ToString(), "Queued");
                    StatusMessaging.UpdateStatus(CharacterSlot.Feet.ToString(), "Queued");
                    StatusMessaging.UpdateStatus(CharacterSlot.Finger1.ToString(), "Queued");
                    StatusMessaging.UpdateStatus(CharacterSlot.Finger2.ToString(), "Queued");
                    StatusMessaging.UpdateStatus(CharacterSlot.Trinket1.ToString(), "Queued");
                    StatusMessaging.UpdateStatus(CharacterSlot.Trinket2.ToString(), "Queued");
                    StatusMessaging.UpdateStatus(CharacterSlot.MainHand.ToString(), "Queued");
                    StatusMessaging.UpdateStatus(CharacterSlot.OffHand.ToString(), "Queued");
                    StatusMessaging.UpdateStatus(CharacterSlot.Ranged.ToString(), "Queued");
                }

                #endregion

                if (slot != CharacterSlot.None)
                {
                    LoadUpgradesForSlot(character, slot, idealGems, usePTR, cancel);
                }
                else
                {
                    LoadUpgradesForSlot(character, CharacterSlot.Head, idealGems, usePTR, cancel);
                    LoadUpgradesForSlot(character, CharacterSlot.Neck, idealGems, usePTR, cancel);
                    LoadUpgradesForSlot(character, CharacterSlot.Shoulders, idealGems, usePTR, cancel);
                    LoadUpgradesForSlot(character, CharacterSlot.Back, idealGems, usePTR, cancel);
                    LoadUpgradesForSlot(character, CharacterSlot.Chest, idealGems, usePTR, cancel);
                    LoadUpgradesForSlot(character, CharacterSlot.Wrist, idealGems, usePTR, cancel);
                    LoadUpgradesForSlot(character, CharacterSlot.Hands, idealGems, usePTR, cancel);
                    LoadUpgradesForSlot(character, CharacterSlot.Waist, idealGems, usePTR, cancel);
                    LoadUpgradesForSlot(character, CharacterSlot.Legs, idealGems, usePTR, cancel);
                    LoadUpgradesForSlot(character, CharacterSlot.Feet, idealGems, usePTR, cancel);
                    LoadUpgradesForSlot(character, CharacterSlot.Finger1, idealGems, usePTR, cancel);
                    LoadUpgradesForSlot(character, CharacterSlot.Finger2, idealGems, usePTR, cancel);
                    LoadUpgradesForSlot(character, CharacterSlot.Trinket1, idealGems, usePTR, cancel);
                    LoadUpgradesForSlot(character, CharacterSlot.Trinket2, idealGems, usePTR, cancel);
                    LoadUpgradesForSlot(character, CharacterSlot.MainHand, idealGems, usePTR, cancel);
                    LoadUpgradesForSlot(character, CharacterSlot.OffHand, idealGems, usePTR, cancel);
                    LoadUpgradesForSlot(character, CharacterSlot.Ranged, idealGems, usePTR, cancel);
                }
            }
            else
            {
                Base.ErrorBox eb = new Base.ErrorBox("", "You need to have a character loaded for Rawr to find Wowhead upgrades.");
                eb.Show();
            }
        }

        public static void ImportItemsFromWowhead(string filter) { ImportItemsFromWowhead(filter, false); }
        public static void ImportItemsFromWowhead(string filter, bool usePTR)
        {
            //WebRequestWrapper.ResetFatalErrorIndicator();

            string docUpgradeSearch = null;
            try
            {
                string site = usePTR ? "ptr" : "www";
                StatusMessaging.UpdateStatus("ImportWowheadFilter", "Downloading Item List");
                WebRequestWrapper wrw = new WebRequestWrapper();
                docUpgradeSearch = wrw.DownloadUpgradesWowhead(site, filter);
                if (docUpgradeSearch != null)
                {
                    // at this stage have an HTML doc that has upgrades in a <div class="listview-void"> block
                    // need to get the itemID list out and then load them and add to cache
                    int startpos = docUpgradeSearch.IndexOf("<div class=\"listview-void\">");
                    if (startpos > 1)
                    {
                        int endpos = docUpgradeSearch.IndexOf("</div>", startpos);
                        XDocument doc = new XDocument();
                        doc.InnerXml = docUpgradeSearch.Substring(startpos, endpos - startpos + 6);
                        List<XElement> nodeList = new List<XElement>(doc.SelectNodes("//a/@href"));

                        Regex toMatch = new Regex("(\\d{5})");
                        Match match;

                        for (int i = 0; i < nodeList.Count; i++)
                        {
                            StatusMessaging.UpdateStatus("ImportWowheadFilter",
                                string.Format("Downloading definition {0} of {1} items", i, nodeList.Count));
                            //string id = nodeList[i].Value.Substring(7);
                            // This new code will let it find the item id without worrying
                            // about wowhead messing with the specifics of the string
                            match = toMatch.Match(nodeList[i].Value);
                            string id = match.Value;
                            {
                                Item item = GetItem(site, id, true);
                                if (item != null)
                                {
                                    ItemCache.AddItem(item, false);
                                }
                            }
                        }
                    }
                }
                else
                {
                    StatusMessaging.ReportError("ImportWowheadFilter", null, "No response returned from Wowhead");
                }
            }
            catch (Exception ex)
            {
                StatusMessaging.ReportError("ImportWowheadFilter", ex, "Error interpreting the data returned from Wowhead");
            }
        }

        private static void LoadUpgradesForSlot(Character character, CharacterSlot slot, Dictionary<ItemSlot, int> idealGems, bool usePTR, UpgradeCancelCheck cancel)
        {
            if (cancel != null && cancel())
                return;

            string docUpgradeSearch = null;
            try
            {
                string site = usePTR ? "ptr" : "www";
                StatusMessaging.UpdateStatus(slot.ToString(), "Downloading Upgrade List");
                ItemInstance itemToUpgrade = character[slot];
                if ((object)itemToUpgrade != null)
                {
                    WebRequestWrapper wrw = new WebRequestWrapper();
                    string minLevel = "minle=" + itemToUpgrade.Item.ItemLevel.ToString() + ";";
                    string filter = getWowheadSlotFilter(slot) + minLevel + getWowheadClassFilter(character.Class) +
                                    getWowheadWeightFilter(character);
                    docUpgradeSearch = wrw.DownloadUpgradesWowhead(site, filter);
                    ComparisonCalculationBase currentCalculation = Calculations.GetItemCalculations(itemToUpgrade, character, slot);
                    if (docUpgradeSearch != null)
                    {
                        // at this stage have an HTML doc that has upgrades in a <div class="listview-void"> block
                        // need to get the itemID list out and then load them and add to cache if better than itemToUpgrade
                        int startpos = docUpgradeSearch.IndexOf("<div class=\"listview-void\">");
                        if (startpos > 1)
                        {
                            int endpos = docUpgradeSearch.IndexOf("</div>", startpos);
                            XDocument doc = new XDocument();
                            doc.InnerXml = docUpgradeSearch.Substring(startpos, endpos - startpos + 6);
                            List<XElement> nodeList = new List<XElement>(doc.SelectNodes("//a/@href"));

                            for (int i = 0; i < nodeList.Count; i++)
                            {
                                if (cancel != null && cancel())
                                    break;

                                StatusMessaging.UpdateStatus(slot.ToString(), string.Format("Downloading definition {0} of {1} possible upgrades", i, nodeList.Count));
                                string id = nodeList[i].Value.Substring(7);
                                if (!ItemCache.Instance.ContainsItemId(int.Parse(id)))
                                {
                                    Item idealItem = GetItem(site, id, true);
                                    if (idealItem != null)
                                    {
                                        ItemInstance idealGemmedItem = new ItemInstance(int.Parse(id), idealGems[idealItem.SocketColor1], idealGems[idealItem.SocketColor2], idealGems[idealItem.SocketColor3], itemToUpgrade.EnchantId);

                                        Item newItem = ItemCache.AddItem(idealItem, false);

                                        //This is calling OnItemsChanged and ItemCache.Add further down the call stack so if we add it to the cache first, 
                                        // then do the compare and remove it if we don't want it, we can avoid that constant event trigger
                                        ComparisonCalculationBase upgradeCalculation = Calculations.GetItemCalculations(idealGemmedItem, character, slot);

                                        if (upgradeCalculation.OverallPoints < (currentCalculation.OverallPoints * .8f))
                                            ItemCache.DeleteItem(newItem, false);
                                    }
                                }
                            }
                        }
                    } else {
                        StatusMessaging.ReportError(slot.ToString(), null, "No response returned from Wowhead");
                    }
                }
                StatusMessaging.UpdateStatusFinished(slot.ToString());
            } catch (Exception ex) {
                StatusMessaging.ReportError(slot.ToString(), ex, "Error interpreting the data returned from Wowhead");
            }
        }
        */

        private static int StatValueSorter(ComparisonCalculationBase x, ComparisonCalculationBase y)
        {
            if (x.OverallPoints > y.OverallPoints)
                return -1;
            else if (x.OverallPoints < y.OverallPoints)
                return 1;
            else
                return 0;
        }
Exemplo n.º 14
0
        public virtual List <ComparisonCalculationBase> GetBuffCalculations(Character character, CharacterCalculationsBase currentCalcs, Buff.BuffType buffType, bool activeOnly)
        {
            ClearCache();
            List <ComparisonCalculationBase> buffCalcs       = new List <ComparisonCalculationBase>();
            CharacterCalculationsBase        calcsEquipped   = null;
            CharacterCalculationsBase        calcsUnequipped = null;
            Character charAutoActivated = character.Clone();

            foreach (Buff autoBuff in currentCalcs.AutoActivatedBuffs)
            {
                if (!charAutoActivated.ActiveBuffs.Contains(autoBuff))
                {
                    charAutoActivated.ActiveBuffs.Add(autoBuff);
                    RemoveConflictingBuffs(charAutoActivated.ActiveBuffs, autoBuff);
                }
            }
            charAutoActivated.DisableBuffAutoActivation = true;
            foreach (Buff buff in Buff.GetBuffsByType(buffType))
            {
                if (!activeOnly || charAutoActivated.ActiveBuffs.Contains(buff))
                {
                    Character charUnequipped = charAutoActivated.Clone();
                    Character charEquipped   = charAutoActivated.Clone();
                    charUnequipped.DisableBuffAutoActivation = true;
                    charEquipped.DisableBuffAutoActivation   = true;
                    if (charUnequipped.ActiveBuffs.Contains(buff))
                    {
                        charUnequipped.ActiveBuffs.Remove(buff);
                    }
                    if (string.IsNullOrEmpty(buff.RequiredBuff))
                    {
                        //if (charUnequipped.ActiveBuffs.Contains("Improved " + buff.Name))
                        //	charUnequipped.ActiveBuffs.Remove("Improved " + buff.Name);
                        charUnequipped.ActiveBuffs.RemoveAll(x => x.Name == "Improved " + buff.Name);
                    }
                    else
                    {
                        //if (charUnequipped.ActiveBuffs.Contains(buff.RequiredBuff))
                        //	charUnequipped.ActiveBuffs.Remove(buff.RequiredBuff);
                        charUnequipped.ActiveBuffs.RemoveAll(x => x.Name == buff.RequiredBuff);
                    }

                    if (!charEquipped.ActiveBuffs.Contains(buff))
                    {
                        charEquipped.ActiveBuffs.Add(buff);
                    }
                    if (string.IsNullOrEmpty(buff.RequiredBuff))
                    {
                        //if (charEquipped.ActiveBuffs.Contains("Improved " + buff.Name))
                        //	charEquipped.ActiveBuffs.Remove("Improved " + buff.Name);
                        charEquipped.ActiveBuffs.RemoveAll(x => x.Name == "Improved " + buff.Name);
                    }
                    else
                    {
                        //if (!charEquipped.ActiveBuffs.Contains(buff.RequiredBuff))
                        //	charEquipped.ActiveBuffs.Add(buff.RequiredBuff);
                        Buff requiredBuff = Buff.GetBuffByName(buff.RequiredBuff);
                        if (!charEquipped.ActiveBuffs.Contains(requiredBuff))
                        {
                            charEquipped.ActiveBuffs.Add(requiredBuff);
                        }
                    }

                    RemoveConflictingBuffs(charEquipped.ActiveBuffs, buff);
                    RemoveConflictingBuffs(charUnequipped.ActiveBuffs, buff);

                    calcsUnequipped = GetCharacterCalculations(charUnequipped);
                    calcsEquipped   = GetCharacterCalculations(charEquipped);

                    ComparisonCalculationBase buffCalc = CreateNewComparisonCalculation();
                    buffCalc.Name = buff.Name;
                    buffCalc.Item = new Item()
                    {
                        Name = buff.Name, Stats = buff.Stats, Quality = Item.ItemQuality.Temp
                    };
                    buffCalc.Equipped      = charAutoActivated.ActiveBuffs.Contains(buff);
                    buffCalc.OverallPoints = calcsEquipped.OverallPoints - calcsUnequipped.OverallPoints;
                    float[] subPoints = new float[calcsEquipped.SubPoints.Length];
                    for (int i = 0; i < calcsEquipped.SubPoints.Length; i++)
                    {
                        subPoints[i] = calcsEquipped.SubPoints[i] - calcsUnequipped.SubPoints[i];
                    }
                    buffCalc.SubPoints = subPoints;
                    buffCalcs.Add(buffCalc);
                }
            }
            return(buffCalcs);
        }
Exemplo n.º 15
0
        public virtual ComparisonCalculationBase GetItemCalculations(Item item, Character character, Character.CharacterSlot slot)
        {
            bool      useCache = character == _cachedCharacter && slot == _cachedSlot;
            Character characterWithSlotEmpty = null;

            if (!useCache)
            {
                characterWithSlotEmpty = character.Clone();
            }
            Character characterWithNewItem = character.Clone();

            if (slot != Character.CharacterSlot.Metas && slot != Character.CharacterSlot.Gems)
            {
                if (!useCache)
                {
                    characterWithSlotEmpty[slot] = null;
                }
                characterWithNewItem[slot] = item;
            }


            CharacterCalculationsBase characterStatsWithSlotEmpty;

            if (useCache)
            {
                characterStatsWithSlotEmpty = _cachedCharacterStatsWithSlotEmpty;
            }
            else
            {
                characterStatsWithSlotEmpty = GetCharacterCalculations(characterWithSlotEmpty);
                _cachedCharacter            = character;
                _cachedSlot = slot;
                _cachedCharacterStatsWithSlotEmpty = characterStatsWithSlotEmpty;
            }


            Item additionalItem = null;

            if (item.FitsInSlot(Character.CharacterSlot.Gems) || item.FitsInSlot(Character.CharacterSlot.Metas))
            {
                additionalItem = item;
            }
            CharacterCalculationsBase characterStatsWithNewItem = GetCharacterCalculations(characterWithNewItem, additionalItem);

            ComparisonCalculationBase itemCalc = CreateNewComparisonCalculation();

            itemCalc.Item          = item;
            itemCalc.Name          = item.Name;
            itemCalc.Equipped      = character[slot] == item;
            itemCalc.OverallPoints = characterStatsWithNewItem.OverallPoints - characterStatsWithSlotEmpty.OverallPoints;
            float[] subPoints = new float[characterStatsWithNewItem.SubPoints.Length];
            for (int i = 0; i < characterStatsWithNewItem.SubPoints.Length; i++)
            {
                subPoints[i] = characterStatsWithNewItem.SubPoints[i] - characterStatsWithSlotEmpty.SubPoints[i];
            }
            itemCalc.SubPoints = subPoints;

            characterStatsWithNewItem.ToString();

            return(itemCalc);
        }