コード例 #1
0
        private void UpdateCardTooltip()
        {
            var pos = User32.GetMousePos();
            var relativePlayerDeckPos   = ViewBoxPlayer.PointFromScreen(new Point(pos.X, pos.Y));
            var relativeOpponentDeckPos = ViewBoxOpponent.PointFromScreen(new Point(pos.X, pos.Y));
            var relativeSecretsPos      = StackPanelSecrets.PointFromScreen(new Point(pos.X, pos.Y));
            var relativeCardMark        = _cardMarks.Select(x => new { Label = x, Pos = x.PointFromScreen(new Point(pos.X, pos.Y)) });
            var visibility = (Config.Instance.OverlayCardToolTips && !Config.Instance.OverlaySecretToolTipsOnly)
                                                                 ? Visible : Hidden;

            var cardMark =
                relativeCardMark.FirstOrDefault(
                    x =>
                    x.Label.IsVisible && PointInsideControl(x.Pos, x.Label.ActualWidth, x.Label.ActualHeight, new Thickness(3, 1, 7, 1)));

            ToolTipCardBlock.CreatedByVisibility = Collapsed;
            if (!Config.Instance.HideOpponentCardMarks && cardMark != null)
            {
                var index       = _cardMarks.IndexOf(cardMark.Label);
                var drawnEntity = _game.Opponent.Hand.FirstOrDefault(x => x.GetTag(GameTag.ZONE_POSITION) == index + 1 && x.Info.GetDrawerId() != null);
                var entity      = _game.Opponent.Hand.FirstOrDefault(x => x.GetTag(GameTag.ZONE_POSITION) == index + 1 && x.HasCardId && !x.Info.Hidden);
                var card        = entity?.Card;
                var creatorCard = _cardMarks[index].SourceCard;
                if (card != null || creatorCard != null)
                {
                    if (creatorCard != null || drawnEntity != null)
                    {
                        var creatorDescription = "Created By ";
                        if (drawnEntity?.Info.GetDrawerId() != null && drawnEntity?.Info.GetDrawerId() > 0)
                        {
                            creatorDescription = "Drawn By ";
                        }
                        ToolTipCardBlock.CreatedByText       = $"{creatorDescription}{creatorCard.Name}";
                        ToolTipCardBlock.CreatedByVisibility = Visible;
                    }
                    ToolTipCardBlock.SetCardIdFromCard(card ?? creatorCard);
                    var offset     = _cardMarks[index].ActualHeight * 1.1;
                    var topOffset  = Canvas.GetTop(_cardMarks[index]) + offset;
                    var leftOffset = Canvas.GetLeft(_cardMarks[index]) + offset;
                    Canvas.SetTop(ToolTipCardBlock, topOffset);
                    Canvas.SetLeft(ToolTipCardBlock, leftOffset);
                    ToolTipCardBlock.Visibility = Config.Instance.OverlayCardMarkToolTips ? Visible : Hidden;
                }
                else
                {
                    ToolTipCardBlock.Visibility = Hidden;
                }
            }
            //player card tooltips
            else if (ListViewPlayer.Visibility == Visible && StackPanelPlayer.Visibility == Visible &&
                     PointInsideControl(relativePlayerDeckPos, ListViewPlayer.ActualWidth, ListViewPlayer.ActualHeight))
            {
                //card size = card list height / amount of cards
                var cardSize  = ViewBoxPlayer.ActualHeight / ListViewPlayer.Items.Count;
                var cardIndex = (int)(relativePlayerDeckPos.Y / cardSize);
                if (cardIndex < 0 || cardIndex >= ListViewPlayer.Items.Count)
                {
                    return;
                }

                var card = ListViewPlayer.Items.Cast <AnimatedCard>().ElementAt(cardIndex).Card;
                ToolTipCardBlock.SetCardIdFromCard(card);
                var centeredListOffset = Config.Instance.OverlayCenterPlayerStackPanel ? (BorderStackPanelPlayer.ActualHeight - StackPanelPlayer.ActualHeight) / 2 : 0;
                //offset is affected by scaling
                var topOffset = Canvas.GetTop(BorderStackPanelPlayer) + centeredListOffset
                                + GetListViewOffset(StackPanelPlayer) + cardIndex * cardSize * Config.Instance.OverlayPlayerScaling / 100 - ToolTipCardBlock.ActualHeight / 2;

                //prevent tooltip from going outside of the overlay
                if (topOffset + ToolTipCardBlock.ActualHeight > Height)
                {
                    topOffset = Height - ToolTipCardBlock.ActualHeight;
                }
                topOffset = Math.Max(0, topOffset);

                SetTooltipPosition(topOffset, BorderStackPanelPlayer);

                ToolTipCardBlock.Visibility = visibility;
            }
            //opponent card tooltips
            else if (ListViewOpponent.Visibility == Visible && StackPanelOpponent.Visibility == Visible &&
                     PointInsideControl(relativeOpponentDeckPos, ListViewOpponent.ActualWidth, ListViewOpponent.ActualHeight))
            {
                //card size = card list height / amount of cards
                var cardSize  = ViewBoxOpponent.ActualHeight / ListViewOpponent.Items.Count;
                var cardIndex = (int)(relativeOpponentDeckPos.Y / cardSize);
                if (cardIndex < 0 || cardIndex >= ListViewOpponent.Items.Count)
                {
                    return;
                }

                var centeredListOffset = Config.Instance.OverlayCenterOpponentStackPanel ? (BorderStackPanelOpponent.ActualHeight - StackPanelOpponent.ActualHeight) / 2 : 0;
                //offset is affected by scaling
                var topOffset = Canvas.GetTop(BorderStackPanelOpponent) + centeredListOffset
                                + GetListViewOffset(StackPanelOpponent) + cardIndex * cardSize * Config.Instance.OverlayOpponentScaling / 100 - ToolTipCardBlock.ActualHeight / 2;
                var card = ListViewOpponent.Items.Cast <AnimatedCard>().ElementAt(cardIndex).Card;
                ToolTipCardBlock.SetCardIdFromCard(card);
                //prevent tooltip from going outside of the overlay
                if (topOffset + ToolTipCardBlock.ActualHeight > Height)
                {
                    topOffset = Height - ToolTipCardBlock.ActualHeight;
                }
                topOffset = Math.Max(0, topOffset);
                SetTooltipPosition(topOffset, BorderStackPanelOpponent);

                ToolTipCardBlock.Visibility = visibility;
            }
            else if (StackPanelSecrets.Visibility == Visible &&
                     PointInsideControl(relativeSecretsPos, StackPanelSecrets.ActualWidth, StackPanelSecrets.ActualHeight))
            {
                //card size = card list height / amount of cards
                var cardSize  = StackPanelSecrets.ActualHeight / StackPanelSecrets.Children.Count;
                var cardIndex = (int)(relativeSecretsPos.Y / cardSize);
                if (cardIndex < 0 || cardIndex >= StackPanelSecrets.Children.Count)
                {
                    return;
                }

                //offset is affected by scaling
                var topOffset = Canvas.GetTop(StackPanelSecrets) + cardIndex * cardSize * Config.Instance.OverlayOpponentScaling / 100 - ToolTipCardBlock.ActualHeight / 2;
                var card      = StackPanelSecrets.Children.Cast <Controls.Card>().ElementAt(cardIndex);
                ToolTipCardBlock.SetCardIdFromCard(new Hearthstone.Card()
                {
                    Id = card.CardId, BaconCard = false
                });
                //prevent tooltip from going outside of the overlay
                if (topOffset + ToolTipCardBlock.ActualHeight > Height)
                {
                    topOffset = Height - ToolTipCardBlock.ActualHeight;
                }
                topOffset = Math.Max(0, topOffset);
                SetTooltipPosition(topOffset, StackPanelSecrets);

                ToolTipCardBlock.Visibility = Config.Instance.OverlaySecretToolTipsOnly ? Visible : visibility;
            }
            else if (BgsTopBar.Visibility == Visible && BattlegroundsMinionsPanel.Visibility == Visible && BattlegroundsMinionsPanel.ActiveTier > 0)
            {
                var found = false;
                foreach (var group in BattlegroundsMinionsPanel.Groups)
                {
                    var cardList = group.Cards;
                    if (!group.IsVisible || !cardList.IsVisible)
                    {
                        continue;
                    }
                    var relativePos = cardList.PointFromScreen(new Point(pos.X, pos.Y));
                    if (PointInsideControl(relativePos, cardList.ActualWidth, cardList.ActualHeight))
                    {
                        var cards     = cardList.ItemsControl.Items;
                        var cardSize  = cardList.ActualHeight / cards.Count;
                        var cardIndex = (int)(relativePos.Y / cardSize);
                        if (cardIndex < 0 || cardIndex >= cards.Count)
                        {
                            return;
                        }
                        var card = cards.GetItemAt(cardIndex) as AnimatedCard;
                        if (card == null)
                        {
                            return;
                        }
                        ToolTipCardBlock.SetCardIdFromCard(card.Card);
                        //offset is affected by scaling
                        var cardListPos = cardList.TransformToAncestor(CanvasInfo).Transform(new Point(0, 0));
                        var topOffset   = cardListPos.Y + cardIndex * cardSize * AutoScaling - ToolTipCardBlock.ActualHeight / 2;
                        topOffset = Math.Max(0, topOffset);
                        //prevent tooltip from going outside of the overlay
                        if (topOffset + ToolTipCardBlock.ActualHeight > Height)
                        {
                            topOffset = Height - ToolTipCardBlock.ActualHeight;
                        }

                        Canvas.SetTop(ToolTipCardBlock, topOffset);
                        Canvas.SetLeft(ToolTipCardBlock, cardListPos.X - ToolTipCardBlock.ActualWidth + 22);

                        ToolTipCardBlock.Visibility = visibility;
                        found = true;
                    }
                }

                if (!found)
                {
                    ToolTipCardBlock.Visibility = Hidden;
                    HideAdditionalToolTips();
                    ToolTipCardBlock.SetCardIdFromCard(null);
                }
            }
            else
            {
                ToolTipCardBlock.SetCardIdFromCard(null);
                ToolTipCardBlock.Visibility = Hidden;
                HideAdditionalToolTips();
            }

            if (!Config.Instance.ForceMouseHook)
            {
                if (Config.Instance.ExtraFeatures)
                {
                    var relativePos = PointFromScreen(new Point(pos.X, pos.Y));
                    if ((StackPanelSecrets.IsVisible &&
                         (PointInsideControl(StackPanelSecrets.PointFromScreen(new Point(pos.X, pos.Y)), StackPanelSecrets.ActualWidth,
                                             StackPanelSecrets.ActualHeight, new Thickness(20))) || relativePos.X < 170 && relativePos.Y > Height - 120))
                    {
                        if (_mouseInput == null)
                        {
                            HookMouse();
                        }
                    }
                    else if (_mouseInput != null && !((_isFriendsListOpen.HasValue && _isFriendsListOpen.Value) || Reflection.IsFriendsListVisible()))
                    {
                        UnHookMouse();
                    }
                }
                else if (_mouseInput != null)
                {
                    UnHookMouse();
                }
            }
        }
コード例 #2
0
        private async Task UpdateCardTooltip()
        {
            var pos = User32.GetMousePos();
            var relativePlayerDeckPos   = ViewBoxPlayer.PointFromScreen(new Point(pos.X, pos.Y));
            var relativeOpponentDeckPos = ViewBoxOpponent.PointFromScreen(new Point(pos.X, pos.Y));
            var relativeSecretsPos      = StackPanelSecrets.PointFromScreen(new Point(pos.X, pos.Y));
            var relativeCardMark        = _cardMarks.Select(x => new { Label = x, Pos = x.PointFromScreen(new Point(pos.X, pos.Y)) });
            var visibility = (Config.Instance.OverlayCardToolTips && !Config.Instance.OverlaySecretToolTipsOnly)
                                                                 ? Visible : Hidden;

            var cardMark =
                relativeCardMark.FirstOrDefault(
                    x =>
                    x.Label.IsVisible && PointInsideControl(x.Pos, x.Label.ActualWidth, x.Label.ActualHeight, new Thickness(3, 1, 7, 1)));

            if (!Config.Instance.HideOpponentCardMarks && cardMark != null)
            {
                var index = _cardMarks.IndexOf(cardMark.Label);
                var card  = _game.Opponent.Hand.FirstOrDefault(x => x.GetTag(GameTag.ZONE_POSITION) == index + 1 && x.HasCardId && !x.Info.Hidden)?.Card;
                if (card != null)
                {
                    ToolTipCard.SetValue(DataContextProperty, card);
                    var topOffset  = Canvas.GetTop(_cardMarks[index]) + _cardMarks[index].ActualHeight;
                    var leftOffset = Canvas.GetLeft(_cardMarks[index]) + _cardMarks[index].ActualWidth * index;
                    Canvas.SetTop(ToolTipCard, topOffset);
                    Canvas.SetLeft(ToolTipCard, leftOffset);
                    ToolTipCard.Visibility = Config.Instance.OverlayCardMarkToolTips ? Visible : Hidden;
                }
            }
            //player card tooltips
            else if (ListViewPlayer.Visibility == Visible && StackPanelPlayer.Visibility == Visible &&
                     PointInsideControl(relativePlayerDeckPos, ListViewPlayer.ActualWidth, ListViewPlayer.ActualHeight))
            {
                //card size = card list height / ammount of cards
                var cardSize  = ViewBoxPlayer.ActualHeight / ListViewPlayer.Items.Count;
                var cardIndex = (int)(relativePlayerDeckPos.Y / cardSize);
                if (cardIndex < 0 || cardIndex >= ListViewPlayer.Items.Count)
                {
                    return;
                }

                ToolTipCard.SetValue(DataContextProperty, ListViewPlayer.Items.Cast <AnimatedCard>().ElementAt(cardIndex).Card);

                var centeredListOffset = Config.Instance.OverlayCenterPlayerStackPanel ? (BorderStackPanelPlayer.ActualHeight - StackPanelPlayer.ActualHeight) / 2 : 0;
                //offset is affected by scaling
                var topOffset = Canvas.GetTop(BorderStackPanelPlayer) + centeredListOffset
                                + GetListViewOffset(StackPanelPlayer) + cardIndex * cardSize * Config.Instance.OverlayPlayerScaling / 100;

                //prevent tooltip from going outside of the overlay
                if (topOffset + ToolTipCard.ActualHeight > Height)
                {
                    topOffset = Height - ToolTipCard.ActualHeight;
                }

                SetTooltipPosition(topOffset, BorderStackPanelPlayer);

                ToolTipCard.Visibility = visibility;
            }
            //opponent card tooltips
            else if (ListViewOpponent.Visibility == Visible && StackPanelOpponent.Visibility == Visible &&
                     PointInsideControl(relativeOpponentDeckPos, ListViewOpponent.ActualWidth, ListViewOpponent.ActualHeight))
            {
                //card size = card list height / ammount of cards
                var cardSize  = ViewBoxOpponent.ActualHeight / ListViewOpponent.Items.Count;
                var cardIndex = (int)(relativeOpponentDeckPos.Y / cardSize);
                if (cardIndex < 0 || cardIndex >= ListViewOpponent.Items.Count)
                {
                    return;
                }

                ToolTipCard.SetValue(DataContextProperty, ListViewOpponent.Items.Cast <AnimatedCard>().ElementAt(cardIndex).Card);

                var centeredListOffset = Config.Instance.OverlayCenterOpponentStackPanel ? (BorderStackPanelOpponent.ActualHeight - StackPanelOpponent.ActualHeight) / 2 : 0;
                //offset is affected by scaling
                var topOffset = Canvas.GetTop(BorderStackPanelOpponent) + centeredListOffset
                                + GetListViewOffset(StackPanelOpponent) + cardIndex * cardSize * Config.Instance.OverlayOpponentScaling / 100;

                //prevent tooltip from going outside of the overlay
                if (topOffset + ToolTipCard.ActualHeight > Height)
                {
                    topOffset = Height - ToolTipCard.ActualHeight;
                }

                SetTooltipPosition(topOffset, BorderStackPanelOpponent);

                ToolTipCard.Visibility = visibility;
            }
            else if (StackPanelSecrets.Visibility == Visible &&
                     PointInsideControl(relativeSecretsPos, StackPanelSecrets.ActualWidth, StackPanelSecrets.ActualHeight))
            {
                //card size = card list height / ammount of cards
                var cardSize  = StackPanelSecrets.ActualHeight / StackPanelSecrets.Children.Count;
                var cardIndex = (int)(relativeSecretsPos.Y / cardSize);
                if (cardIndex < 0 || cardIndex >= StackPanelSecrets.Children.Count)
                {
                    return;
                }

                ToolTipCard.SetValue(DataContextProperty, StackPanelSecrets.Children[cardIndex].GetValue(DataContextProperty));

                //offset is affected by scaling
                var topOffset = Canvas.GetTop(StackPanelSecrets) + cardIndex * cardSize * Config.Instance.OverlayOpponentScaling / 100;

                //prevent tooltip from going outside of the overlay
                if (topOffset + ToolTipCard.ActualHeight > Height)
                {
                    topOffset = Height - ToolTipCard.ActualHeight;
                }

                SetTooltipPosition(topOffset, StackPanelSecrets);

                ToolTipCard.Visibility = Config.Instance.OverlaySecretToolTipsOnly ? Visible : visibility;
            }
            else
            {
                ToolTipCard.Visibility = Hidden;
                HideAdditionalToolTips();
            }

            if (ToolTipCard.Visibility == Visible)
            {
                var card = ToolTipCard.GetValue(DataContextProperty) as Card;
                if (card != null)
                {
                    if (_lastToolTipCardId != card.Id)
                    {
                        _lastToolTipCardId = card.Id;
                        ShowAdditionalToolTips();
                    }
                }
                else
                {
                    HideAdditionalToolTips();
                }
            }
            else
            {
                HideAdditionalToolTips();
                _lastToolTipCardId = string.Empty;
            }


            if (!Config.Instance.ForceMouseHook)
            {
                if (Config.Instance.ExtraFeatures)
                {
                    var relativePos = PointFromScreen(new Point(pos.X, pos.Y));
                    if ((StackPanelSecrets.IsVisible &&
                         (PointInsideControl(StackPanelSecrets.PointFromScreen(new Point(pos.X, pos.Y)), StackPanelSecrets.ActualWidth,
                                             StackPanelSecrets.ActualHeight, new Thickness(20))) || relativePos.X < 170 && relativePos.Y > Height - 120))
                    {
                        if (_mouseInput == null)
                        {
                            HookMouse();
                        }
                    }
                    else if (_mouseInput != null && !((_isFriendsListOpen.HasValue && _isFriendsListOpen.Value) || await Helper.FriendsListOpen()))
                    {
                        UnHookMouse();
                    }
                }
                else if (_mouseInput != null)
                {
                    UnHookMouse();
                }
            }

            if (!Config.Instance.AlwaysShowGoldProgress)
            {
                if (_game.IsInMenu &&
                    PointInsideControl(RectGoldDisplay.PointFromScreen(new Point(pos.X, pos.Y)), RectGoldDisplay.ActualWidth,
                                       RectGoldDisplay.ActualHeight))
                {
                    UpdateGoldProgress();
                    GoldProgressGrid.Visibility = Visible;
                }
                else
                {
                    GoldProgressGrid.Visibility = Hidden;
                }
            }
        }
コード例 #3
0
        private void UpdateCardTooltip()
        {
            var pos = User32.GetMousePos();
            var relativePlayerDeckPos   = ViewBoxPlayer.PointFromScreen(new Point(pos.X, pos.Y));
            var relativeOpponentDeckPos = ViewBoxOpponent.PointFromScreen(new Point(pos.X, pos.Y));
            var relativeSecretsPos      = StackPanelSecrets.PointFromScreen(new Point(pos.X, pos.Y));
            var relativeCardMark        = _cardMarks.Select(x => new { Label = x, Pos = x.PointFromScreen(new Point(pos.X, pos.Y)) });
            var visibility = (Config.Instance.OverlayCardToolTips && !Config.Instance.OverlaySecretToolTipsOnly)
                                                                 ? Visible : Hidden;

            ToolTipCard.CardSetToolTip.Visibility = Config.Instance.OverlaySetToolTips ? Visible : Collapsed;
            ToolTipCard.CreatedByVisibility       = Collapsed;

            var cardMark =
                relativeCardMark.FirstOrDefault(
                    x =>
                    x.Label.IsVisible && PointInsideControl(x.Pos, x.Label.ActualWidth, x.Label.ActualHeight, new Thickness(3, 1, 7, 1)));

            if (!Config.Instance.HideOpponentCardMarks && cardMark != null)
            {
                var index       = _cardMarks.IndexOf(cardMark.Label);
                var card        = _game.Opponent.Hand.FirstOrDefault(x => x.GetTag(GameTag.ZONE_POSITION) == index + 1 && x.HasCardId && !x.Info.Hidden)?.Card;
                var creatorCard = _cardMarks[index].SourceCard;
                if (card != null || creatorCard != null)
                {
                    ToolTipCard.SetValue(DataContextProperty, card ?? creatorCard);
                    var offset     = _cardMarks[index].ActualHeight * 1.25;
                    var topOffset  = Canvas.GetTop(_cardMarks[index]) + offset;
                    var leftOffset = Canvas.GetLeft(_cardMarks[index]) + offset;
                    Canvas.SetTop(ToolTipCard, topOffset);
                    Canvas.SetLeft(ToolTipCard, leftOffset);
                    ToolTipCard.Visibility          = Config.Instance.OverlayCardMarkToolTips ? Visible : Hidden;
                    ToolTipCard.CreatedByVisibility = card != null ? Collapsed : Visible;
                }
                else
                {
                    ToolTipCard.Visibility          = Hidden;
                    ToolTipCard.CreatedByVisibility = Collapsed;
                }
            }
            //player card tooltips
            else if (ListViewPlayer.Visibility == Visible && StackPanelPlayer.Visibility == Visible &&
                     PointInsideControl(relativePlayerDeckPos, ListViewPlayer.ActualWidth, ListViewPlayer.ActualHeight))
            {
                //card size = card list height / amount of cards
                var cardSize  = ViewBoxPlayer.ActualHeight / ListViewPlayer.Items.Count;
                var cardIndex = (int)(relativePlayerDeckPos.Y / cardSize);
                if (cardIndex < 0 || cardIndex >= ListViewPlayer.Items.Count)
                {
                    return;
                }

                ToolTipCard.SetValue(DataContextProperty, ListViewPlayer.Items.Cast <AnimatedCard>().ElementAt(cardIndex).Card);

                var centeredListOffset = Config.Instance.OverlayCenterPlayerStackPanel ? (BorderStackPanelPlayer.ActualHeight - StackPanelPlayer.ActualHeight) / 2 : 0;
                //offset is affected by scaling
                var topOffset = Canvas.GetTop(BorderStackPanelPlayer) + centeredListOffset
                                + GetListViewOffset(StackPanelPlayer) + cardIndex * cardSize * Config.Instance.OverlayPlayerScaling / 100;

                //prevent tooltip from going outside of the overlay
                if (topOffset + ToolTipCard.ActualHeight > Height)
                {
                    topOffset = Height - ToolTipCard.ActualHeight;
                }

                SetTooltipPosition(topOffset, BorderStackPanelPlayer);

                ToolTipCard.Visibility = visibility;
            }
            //opponent card tooltips
            else if (ListViewOpponent.Visibility == Visible && StackPanelOpponent.Visibility == Visible &&
                     PointInsideControl(relativeOpponentDeckPos, ListViewOpponent.ActualWidth, ListViewOpponent.ActualHeight))
            {
                //card size = card list height / amount of cards
                var cardSize  = ViewBoxOpponent.ActualHeight / ListViewOpponent.Items.Count;
                var cardIndex = (int)(relativeOpponentDeckPos.Y / cardSize);
                if (cardIndex < 0 || cardIndex >= ListViewOpponent.Items.Count)
                {
                    return;
                }

                ToolTipCard.SetValue(DataContextProperty, ListViewOpponent.Items.Cast <AnimatedCard>().ElementAt(cardIndex).Card);

                var centeredListOffset = Config.Instance.OverlayCenterOpponentStackPanel ? (BorderStackPanelOpponent.ActualHeight - StackPanelOpponent.ActualHeight) / 2 : 0;
                //offset is affected by scaling
                var topOffset = Canvas.GetTop(BorderStackPanelOpponent) + centeredListOffset
                                + GetListViewOffset(StackPanelOpponent) + cardIndex * cardSize * Config.Instance.OverlayOpponentScaling / 100;

                //prevent tooltip from going outside of the overlay
                if (topOffset + ToolTipCard.ActualHeight > Height)
                {
                    topOffset = Height - ToolTipCard.ActualHeight;
                }

                SetTooltipPosition(topOffset, BorderStackPanelOpponent);

                ToolTipCard.Visibility = visibility;
            }
            else if (StackPanelSecrets.Visibility == Visible &&
                     PointInsideControl(relativeSecretsPos, StackPanelSecrets.ActualWidth, StackPanelSecrets.ActualHeight))
            {
                //card size = card list height / amount of cards
                var cardSize  = StackPanelSecrets.ActualHeight / StackPanelSecrets.Children.Count;
                var cardIndex = (int)(relativeSecretsPos.Y / cardSize);
                if (cardIndex < 0 || cardIndex >= StackPanelSecrets.Children.Count)
                {
                    return;
                }

                ToolTipCard.SetValue(DataContextProperty, StackPanelSecrets.Children[cardIndex].GetValue(DataContextProperty));

                //offset is affected by scaling
                var topOffset = Canvas.GetTop(StackPanelSecrets) + cardIndex * cardSize * Config.Instance.OverlayOpponentScaling / 100;

                //prevent tooltip from going outside of the overlay
                if (topOffset + ToolTipCard.ActualHeight > Height)
                {
                    topOffset = Height - ToolTipCard.ActualHeight;
                }

                SetTooltipPosition(topOffset, StackPanelSecrets);

                ToolTipCard.Visibility = Config.Instance.OverlaySecretToolTipsOnly ? Visible : visibility;
            }
            else if (BgsTopBar.Visibility == Visible && BattlegroundsMinionsPanel.Visibility == Visible && BattlegroundsMinionsPanel.ActiveTier > 0)
            {
                var found = false;
                foreach (var group in BattlegroundsMinionsPanel.Groups)
                {
                    var cardList = group.Cards;
                    if (!group.IsVisible || !cardList.IsVisible)
                    {
                        continue;
                    }
                    var relativePos = cardList.PointFromScreen(new Point(pos.X, pos.Y));
                    if (PointInsideControl(relativePos, cardList.ActualWidth, cardList.ActualHeight))
                    {
                        var cards     = cardList.ItemsControl.Items;
                        var cardSize  = cardList.ActualHeight / cards.Count;
                        var cardIndex = (int)(relativePos.Y / cardSize);
                        if (cardIndex < 0 || cardIndex >= cards.Count)
                        {
                            return;
                        }
                        var card = cards.GetItemAt(cardIndex) as AnimatedCard;
                        if (card == null)
                        {
                            return;
                        }
                        ToolTipCard.SetValue(DataContextProperty, card.GetValue(DataContextProperty));

                        //offset is affected by scaling
                        var cardListPos = cardList.TransformToAncestor(CanvasInfo).Transform(new Point(0, 0));
                        var topOffset   = cardListPos.Y + cardIndex * cardSize * AutoScaling;

                        //prevent tooltip from going outside of the overlay
                        if (topOffset + ToolTipCard.ActualHeight > Height)
                        {
                            topOffset = Height - ToolTipCard.ActualHeight;
                        }

                        Canvas.SetTop(ToolTipCard, topOffset);
                        Canvas.SetLeft(ToolTipCard, cardListPos.X - ToolTipCard.ActualWidth + 22);

                        ToolTipCard.Visibility = visibility;
                        found = true;
                    }
                }

                if (!found)
                {
                    ToolTipCard.Visibility = Hidden;
                    HideAdditionalToolTips();
                }
            }
            else
            {
                ToolTipCard.Visibility = Hidden;
                HideAdditionalToolTips();
            }

            if (ToolTipCard.Visibility == Visible)
            {
                if (ToolTipCard.GetValue(DataContextProperty) is Card card)
                {
                    if (_lastToolTipCardId != card.Id)
                    {
                        _lastToolTipCardId = card.Id;
                        ShowAdditionalToolTips();
                    }
                }
                else
                {
                    HideAdditionalToolTips();
                }
            }
            else
            {
                HideAdditionalToolTips();
                _lastToolTipCardId = string.Empty;
            }


            if (!Config.Instance.ForceMouseHook)
            {
                if (Config.Instance.ExtraFeatures)
                {
                    var relativePos = PointFromScreen(new Point(pos.X, pos.Y));
                    if ((StackPanelSecrets.IsVisible &&
                         (PointInsideControl(StackPanelSecrets.PointFromScreen(new Point(pos.X, pos.Y)), StackPanelSecrets.ActualWidth,
                                             StackPanelSecrets.ActualHeight, new Thickness(20))) || relativePos.X < 170 && relativePos.Y > Height - 120))
                    {
                        if (_mouseInput == null)
                        {
                            HookMouse();
                        }
                    }
                    else if (_mouseInput != null && !((_isFriendsListOpen.HasValue && _isFriendsListOpen.Value) || Reflection.IsFriendsListVisible()))
                    {
                        UnHookMouse();
                    }
                }
                else if (_mouseInput != null)
                {
                    UnHookMouse();
                }
            }

            if (!Config.Instance.AlwaysShowGoldProgress)
            {
                if (_game.IsInMenu &&
                    PointInsideControl(RectGoldDisplay.PointFromScreen(new Point(pos.X, pos.Y)), RectGoldDisplay.ActualWidth,
                                       RectGoldDisplay.ActualHeight))
                {
                    UpdateGoldProgress();
                    GoldProgressGrid.Visibility = Visible;
                }
                else
                {
                    GoldProgressGrid.Visibility = Hidden;
                }
            }
        }