Exemple #1
0
        private bool DrawBorder(long entityAddress, ItemDisplayData data)
        {
            var ui           = GameController.Game.IngameState.IngameUi;
            var shouldUpdate = false;

            if (_currentLabels.TryGetValue(entityAddress, out var entityLabel))
            {
                if (!entityLabel.IsVisible)
                {
                    return(shouldUpdate);
                }

                var rect = entityLabel.Label.GetClientRect();
                if (ui.OpenLeftPanel.IsVisible && ui.OpenLeftPanel.GetClientRect().Intersects(rect) ||
                    ui.OpenRightPanel.IsVisible && ui.OpenRightPanel.GetClientRect().Intersects(rect))
                {
                    return(false);
                }

                var incrSize = Settings.BorderOversize.Value;

                if (Settings.BorderAutoResize.Value)
                {
                    incrSize = (int)Lerp(incrSize, 1, data.PriorityPercent);
                }

                rect.X -= incrSize;
                rect.Y -= incrSize;

                rect.Width  += incrSize * 2;
                rect.Height += incrSize * 2;

                var borderColor = Color.Lerp(Color.Red, Color.Green, data.PriorityPercent);


                var borderWidth = Settings.BorderWidth.Value;

                if (Settings.BorderAutoResize.Value)
                {
                    borderWidth = (int)Lerp(borderWidth, 1, data.PriorityPercent);
                }

                Graphics.DrawFrame(rect, borderWidth, borderColor);

                if (Settings.TextSize.Value == 0)
                {
                    return(shouldUpdate);
                }

                if (Settings.TextOffsetX < 0)
                {
                    rect.X += Settings.TextOffsetX;
                }
                else
                {
                    rect.X += rect.Width * (Settings.TextOffsetX.Value / 10);
                }

                if (Settings.TextOffsetY < 0)
                {
                    rect.Y += Settings.TextOffsetY;
                }
                else
                {
                    rect.Y += rect.Height * (Settings.TextOffsetY.Value / 10);
                }

                Graphics.DrawText(
                    Settings.CalcByFreeSpace.Value ? $"{data.FreeSpaceCount}" : $"{data.PriorityPercent:p0}",
                    Settings.TextSize.Value, rect.TopLeft,
                    Color.White
                    );
            }
            else
            {
                shouldUpdate = true;
            }

            return(shouldUpdate);
        }
Exemple #2
0
        private bool DrawBorder(long entityAddress, ItemDisplayData data)
        {
            if (GameController.Game.IngameState.IngameUi.Atlas.IsVisible)
            {
                return(false);
            }

            if (GameController.Game.IngameState.IngameUi.BetrayalWindow.IsVisible)
            {
                return(false);
            }

            if (GameController.Game.IngameState.IngameUi.CraftBench.IsVisible)
            {
                return(false);
            }

            if (GameController.Game.IngameState.IngameUi.DelveWindow.IsVisible)
            {
                return(false);
            }

            if (GameController.Game.IngameState.IngameUi.IncursionWindow.IsVisible)
            {
                return(false);
            }

            /*
             * if (GameController.Game.IngameState.IngameUi.MetamorphWindow.IsVisible)
             *  return false;
             */

            if (GameController.Game.IngameState.IngameUi.TreePanel.IsVisible)
            {
                return(false);
            }

            if (GameController.Game.IngameState.IngameUi.UnveilWindow.IsVisible)
            {
                return(false);
            }

            if (GameController.Game.IngameState.IngameUi.ZanaMissionChoice.IsVisible)
            {
                return(false);
            }

            if (Settings.Ignore1 && data.PriorityPercent == 1 &&
                !(data.BaseData.PartName == "Amulets" || data.BaseData.PartName == "Rings"))
            {
                return(false);
            }

            var ui           = GameController.Game.IngameState.IngameUi;
            var shouldUpdate = false;

            if (_currentLabels.TryGetValue(entityAddress, out var entityLabel))
            {
                if (!entityLabel.IsVisible)
                {
                    return(shouldUpdate);
                }

                var rect = entityLabel.Label.GetClientRect();

                if (ui.OpenLeftPanel.IsVisible && ui.OpenLeftPanel.GetClientRect().Intersects(rect) ||
                    ui.OpenRightPanel.IsVisible && ui.OpenRightPanel.GetClientRect().Intersects(rect))
                {
                    return(false);
                }

                var incrSize = Settings.BorderOversize.Value;

                if (Settings.BorderAutoResize.Value)
                {
                    incrSize = (int)Lerp(incrSize, 1, data.PriorityPercent);
                }

                rect.X -= incrSize;
                rect.Y -= incrSize;

                rect.Width  += incrSize * 2;
                rect.Height += incrSize * 2;

                var borderColor = Color.Lerp(Color.Red, Color.Green, data.PriorityPercent);

                var borderWidth = Settings.BorderWidth.Value;

                if (Settings.BorderAutoResize.Value)
                {
                    borderWidth = (int)Lerp(borderWidth, 1, data.PriorityPercent);
                }

                Graphics.DrawFrame(rect, borderColor, borderWidth);

                if (Settings.TextSize.Value == 0)
                {
                    return(shouldUpdate);
                }

                if (Settings.TextOffsetX < 0)
                {
                    rect.X += Settings.TextOffsetX;
                }
                else
                {
                    rect.X += rect.Width * (Settings.TextOffsetX.Value / 10);
                }

                if (Settings.TextOffsetY < 0)
                {
                    rect.Y += Settings.TextOffsetY;
                }
                else
                {
                    rect.Y += rect.Height * (Settings.TextOffsetY.Value / 10);
                }

                Graphics.DrawText(
                    Settings.CalcByFreeSpace.Value ? $"{data.FreeSpaceCount}" : $"{data.PriorityPercent:p0}", rect.TopLeft,
                    Color.White,
                    Settings.TextSize.Value
                    );
            }
            else
            {
                shouldUpdate = true;
            }

            return(shouldUpdate);
        }