Esempio n. 1
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (Hud.Render.UiHidden)
            {
                return;
            }
            if (clipState != ClipState.AfterClip)
            {
                return;
            }
            if (!Hud.Render.WorldMapUiElement.Visible || Hud.Render.ActMapUiElement.Visible)
            {
                return;
            }

            var mapCurrentAct = Hud.Game.ActMapCurrentAct;

            if (mapCurrentAct == BountyAct.None)
            {
                return;
            }

            var w = 220 * Hud.Window.HeightUiRatio;
            var h = 100 * Hud.Window.HeightUiRatio;

            foreach (var waypoint in Hud.Game.ActMapWaypoints.Where(x => x.BountyAct == mapCurrentAct))
            {
                var quest = Hud.Game.Bounties.FirstOrDefault(x => x.SnoQuest.BountySnoArea == waypoint.TargetSnoArea);
                if ((quest != null) && quest.State != QuestState.completed)
                {
                    var x = Hud.Render.WorldMapUiElement.Rectangle.X + (waypoint.CoordinateOnMapUiElement.X * Hud.Window.HeightUiRatio);
                    var y = Hud.Render.WorldMapUiElement.Rectangle.Y + (waypoint.CoordinateOnMapUiElement.Y * Hud.Window.HeightUiRatio);

                    var font = BountiesToHighlight.Contains(quest.SnoQuest) ? BountyNameHighlightedFont : BountyNameNormalFont;

                    var layout = font.GetTextLayout(quest.SnoQuest.NameLocalized);
                    font.DrawText(layout, x + ((w - layout.Metrics.Width) / 2), y + (float)Math.Ceiling(h * 0.32f));
                }
            }
        }
        public void PaintTopInGame(ClipState clipState)
        {
            var mapCurrentAct = Hud.Game.ActMapCurrentAct;

            var w = 220 * Hud.Window.HeightUiRatio;
            var h = 100 * Hud.Window.HeightUiRatio;

            foreach (var waypoint in Hud.Game.ActMapWaypoints.Where(x => x.BountyAct == mapCurrentAct))
            {
                var quest = Hud.Game.Bounties.FirstOrDefault(x => x.SnoQuest.BountySnoArea == waypoint.TargetSnoArea);
                if ((quest != null) && quest.State != QuestState.completed)
                {
                    if (!Hud.Render.UiHidden && clipState == ClipState.AfterClip && (Hud.Render.WorldMapUiElement.Visible || Hud.Render.ActMapUiElement.Visible))
                    {
                        var x = Hud.Render.WorldMapUiElement.Rectangle.X + waypoint.CoordinateOnMapUiElement.X * Hud.Window.HeightUiRatio;
                        var y = Hud.Render.WorldMapUiElement.Rectangle.Y + waypoint.CoordinateOnMapUiElement.Y * Hud.Window.HeightUiRatio;

                        var font = BountiesToHighlight.Contains(quest.SnoQuest) ? BountyNameHighlightedFont : BountyNameNormalFont;

                        var layout = font.GetTextLayout(quest.SnoQuest.NameLocalized);
                        font.DrawText(layout, x + (w - layout.Metrics.Width) / 2, y + (float)Math.Ceiling(h * 0.32f));
                    }
                }
            }

            foreach (var waypoint in Hud.Game.ActMapWaypoints.Where(x => x.BountyAct == (BountyAct)400))
            {
                var quest = Hud.Game.Bounties.FirstOrDefault(x => x.SnoQuest.BountySnoArea == waypoint.TargetSnoArea);
                if ((quest != null) && quest.State != QuestState.completed)
                {
                    if (BountiesToPopup.Contains(quest.SnoQuest))
                    {
                        Hud.RunOnPlugin <MaBa.Bounties.BountyPopupPlugin>(plugin =>
                        {
                            plugin.Show(quest.SnoQuest.NameLocalized, "Bounty available", 5000, "");
                        });
                    }
                }
            }
        }