コード例 #1
0
        public override void Render()
        {
            if (!Settings.Enable)
            {
                return;
            }

            ingameUiElements = GameController.Game.IngameState.IngameUi;
            if (ingameUiElements.OpenLeftPanel.IsVisible || ingameUiElements.OpenRightPanel.IsVisible)
            {
                if (ingameUiElements.InventoryPanel.IsVisible)
                {
                    cells = new CellData[CELLS_Y_COUNT, CELLS_X_COUNT];
                    AddItems();
                }
                return;
            }
            RectangleF rect           = GameController.Window.GetWindowRectangle();
            float      xPos           = rect.Width * Settings.PositionX * .01f;
            float      yPos           = rect.Height * Settings.PositionY * .01f;
            var        startDrawPoint = new Vector2(xPos, yPos);

            for (int i = 0; i < cells.GetLength(0); i++)
            {
                for (int j = 0; j < cells.GetLength(1); j++)
                {
                    Vector2 d          = startDrawPoint.Translate(j * Settings.CellSize, i * Settings.CellSize);
                    float   cellWidth  = GetCellSize(cells[i, j].ExtendsX);
                    float   cellHeight = GetCellSize(cells[i, j].ExtendsY);
                    var     rectangleF = new RectangleF(d.X, d.Y, cellWidth, cellHeight);
                    Graphics.DrawBox(rectangleF, cells[i, j].Used ? Settings.CellUsedColor : Settings.CellFreeColor);
                }
            }
        }
コード例 #2
0
        public override void Render()
        {
            if (!holdKey && WinApi.IsKeyDown(Keys.F9))
            {
                holdKey = true;
                Settings.ItemMods.Enable.Value = !Settings.ItemMods.Enable.Value;
                if (!Settings.ItemMods.Enable.Value)
                {
                    SettingsHub.Save(settingsHub);
                }
            }
            else if (holdKey && !WinApi.IsKeyDown(Keys.F9))
            {
                holdKey = false;
            }

            Element uiHover           = GameController.Game.IngameState.UIHover;
            var     inventoryItemIcon = uiHover.AsObject <InventoryItemIcon>();
            Element tooltip           = GetTooltip(inventoryItemIcon);
            Entity  poeEntity         = inventoryItemIcon.Item;

            if (tooltip == null || poeEntity.Address == 0 || !poeEntity.IsValid)
            {
                return;
            }

            RectangleF tooltipRect   = tooltip.GetClientRect();
            var        modsComponent = poeEntity.GetComponent <Mods>();

            if (itemEntity == null || itemEntity.Id != poeEntity.Id)
            {
                List <ItemMod> itemMods = modsComponent.ItemMods;
                mods       = itemMods.Select(item => new ModValue(item, GameController.Files, modsComponent.ItemLevel)).ToList();
                itemEntity = poeEntity;
            }

            if (Settings.ItemLevel.Enable)
            {
                string itemLevel = Convert.ToString(modsComponent.ItemLevel);
                Graphics.DrawText(itemLevel, Settings.ItemLevel.TextSize, tooltipRect.TopLeft.Translate(1, -3), Color.Yellow);
            }

            if (Settings.ItemMods.Enable)
            {
                float bottomTooltip = tooltipRect.Bottom + 5;
                var   modPosition   = new Vector2(tooltipRect.X + 50, bottomTooltip + 4);
                float height        = mods.Aggregate(modPosition, (position, item) => DrawMod(item, position)).Y - bottomTooltip;
                if (height > 4)
                {
                    var modsRect = new RectangleF(tooltipRect.X + 1, bottomTooltip, tooltipRect.Width, height);
                    Graphics.DrawBox(modsRect, Settings.ItemMods.BackgroundColor);
                }
            }

            if (Settings.WeaponDps.Enable && poeEntity.HasComponent <Weapon>())
            {
                DrawWeaponDps(tooltipRect);
            }
        }
コード例 #3
0
        public override void Render()
        {
            try
            {
                if (!holdKey && WinApi.IsKeyDown(Keys.F9))
                {
                    holdKey = true;
                    Settings.ItemMods.Enable.Value = !Settings.ItemMods.Enable.Value;
                    if (!Settings.ItemMods.Enable.Value)
                    {
                        SettingsHub.Save(settingsHub);
                    }
                }
                else if (holdKey && !WinApi.IsKeyDown(Keys.F9))
                {
                    holdKey = false;
                }
                Element uiHover           = GameController.Game.IngameState.UIHover;
                var     inventoryItemIcon = uiHover.AsObject <HoverItemIcon>();

                Element tooltip   = inventoryItemIcon.Tooltip;
                Entity  poeEntity = inventoryItemIcon.Item;

                if (tooltip == null || poeEntity.Address == 0 || !poeEntity.IsValid)
                {
                    return;
                }
                RectangleF tooltipRect = tooltip.GetClientRect();



                var  modsComponent = poeEntity.GetComponent <Mods>();
                long id            = 0;
                if (inventoryItemIcon.ToolTipType == ToolTipType.InventoryItem)
                {
                    id = poeEntity.InventoryId;
                }
                else
                {
                    id = poeEntity.Id;
                }

                if (itemEntity == null || itemEntity.Id != id)
                {
                    List <ItemMod> itemMods = modsComponent.ItemMods;
                    mods = itemMods.Select(item => new ModValue(item, GameController.Files, modsComponent.ItemLevel,
                                                                GameController.Files.BaseItemTypes.Translate(poeEntity.Path))).ToList();
                    itemEntity = poeEntity;
                }

                int t1 = 0;
                foreach (string tier in from item in mods where item.CouldHaveTiers() && item.Tier == 1 select " \u2605 ")
                {
                    Graphics.DrawText(tier, 18, tooltipRect.TopLeft.Translate(0 + 14 * t1++, 56), Settings.ItemMods.T1Color);
                }

                int t2 = 0;
                foreach (string tier in from item in mods where item.CouldHaveTiers() && item.Tier == 2 select " \u2605 ")
                {
                    Graphics.DrawText(tier, 18, tooltipRect.TopLeft.Translate(t1 * 14 + 14 * t2++, 56), Settings.ItemMods.T2Color);
                }

                if (Settings.ItemLevel.Enable)
                {
                    string itemLevel = Convert.ToString(modsComponent.ItemLevel);
                    var    imageSize = Settings.ItemLevel.TextSize + 10;
                    Graphics.DrawText(itemLevel, Settings.ItemLevel.TextSize, tooltipRect.TopLeft.Translate(2, 2), Settings.ItemLevel.TextColor);
                    Graphics.DrawImage("menu-colors.png", new RectangleF(tooltipRect.TopLeft.X - 2, tooltipRect.TopLeft.Y - 2, imageSize, imageSize), Settings.ItemLevel.BackgroundColor);
                }

                if (Settings.ItemMods.Enable)
                {
                    float bottomTooltip = tooltipRect.Bottom + 5;
                    var   modPosition   = new Vector2(tooltipRect.X + 50, bottomTooltip + 4);
                    float height        = mods.Aggregate(modPosition, (position, item) => DrawMod(item, position)).Y - bottomTooltip;
                    if (height > 4)
                    {
                        var modsRect = new RectangleF(tooltipRect.X + 1, bottomTooltip, tooltipRect.Width, height);
                        Graphics.DrawBox(modsRect, Settings.ItemMods.BackgroundColor);
                    }
                }

                if (Settings.WeaponDps.Enable && poeEntity.HasComponent <Weapon>())
                {
                    DrawWeaponDps(tooltipRect);
                }
            }
            catch
            { }
        }