예제 #1
0
        public static void DrawBoxOnItem(Item inventoryItem, bool isUpgrade, bool isDrawn = false)
        {
            if (isDrawn)
            {
                return;
            }
            RectangleF rec = inventoryItem.Original.GetClientRect();

            rec.Right  -= 1;
            rec.Bottom -= 1;
            API.Graphics.DrawBox(rec, Main.Core.Settings.FillColor);
            API.Graphics.DrawFrame(rec, Main.Core.Settings.OutlineThickness, Main.Core.Settings.FrameColor);

            // Draw sum on the item for quickly seeing what has a high value
            if (Main.Core.Settings.SumShow)
            {
                API.Graphics.DrawText(
                    $"{AffixSum.GetSums(inventoryItem)}"
                    , Main.Core.Settings.SumSize, rec.Center, Main.Core.Settings.SumColor, FontDrawFlags.VerticalCenter | FontDrawFlags.Center);
            }
        }
예제 #2
0
        public static void DrawAllValidItems(List <Item> inventoryList, List <Item> characterList)
        {
            foreach (Item inventoryItem in inventoryList)
            {
                bool foundUpgrade = false;
                if (inventoryItem.BaseItemType != ItemTypeParent.None && inventoryItem.Rarity != ItemRarity.Normal && inventoryItem.IsIdentified)
                {
                    float invSum = AffixSum.GetSums(inventoryItem);

                    foreach (Item characterItem in characterList)
                    {
                        if (characterItem.BaseItemType != ItemTypeParent.None && inventoryItem.BaseItemType != ItemTypeParent.None)
                        {
                            bool  isUpgrade;
                            float charSum = 0;
                            if (inventoryItem.SubItemType != ItemTypeChild.None)
                            {
                                if (inventoryItem.SubItemType != characterItem.SubItemType)
                                {
                                    continue;
                                }

                                charSum = AffixSum.GetSums(characterItem);

                                isUpgrade = charSum < invSum;

                                if (!isUpgrade)
                                {
                                    continue;
                                }

                                if (!characterItem.IsUpgrading)
                                {
                                    characterItem.IsUpgrading = true;
                                }
                                foundUpgrade = true;

                                DrawLineToItem(inventoryItem, characterItem, isUpgrade);
                                DrawBoxOnItem(characterItem, charSum, characterItem.IsUpgrading, characterItem.IsDrawn);
                                characterItem.IsDrawn = true;
                            }
                            else if (inventoryItem.BaseItemType != ItemTypeParent.None)
                            {
                                if (inventoryItem.BaseItemType != characterItem.BaseItemType)
                                {
                                    continue;
                                }

                                charSum = AffixSum.GetSums(characterItem);

                                isUpgrade = charSum < invSum;

                                if (!isUpgrade)
                                {
                                    continue;
                                }

                                if (!characterItem.IsUpgrading)
                                {
                                    characterItem.IsUpgrading = true;
                                }
                                foundUpgrade = true;

                                DrawLineToItem(inventoryItem, characterItem, isUpgrade);
                                DrawBoxOnItem(characterItem, charSum, characterItem.IsUpgrading, characterItem.IsDrawn);
                                characterItem.IsDrawn = true;
                            }
                        }
                    }

                    if (foundUpgrade)
                    {
                        DrawBoxOnItem(inventoryItem, invSum, true);
                    }
                }
            }
        }