Beispiel #1
0
        private void DrawChallengeRift()
        {
            var ui = Hud.Render.ChallengeRiftBarUiElement;

            if (!ui.Visible)
            {
                return;
            }

            if (ChallengeRiftTimerEnabled)
            {
                var secondsLeft = (Hud.Game.CurrentTimedEventEndTick - (double)Hud.Game.CurrentGameTick) / 60.0d;
                if (secondsLeft > 0)
                {
                    var totalSeconds = (Hud.Game.CurrentTimedEventEndTick - Hud.Game.CurrentTimedEventStartTick) / 60.0d;
                    var text         = ValueToString((long)(Hud.Game.CurrentTimedEventEndTick - Hud.Game.CurrentGameTick) * 1000 * TimeSpan.TicksPerMillisecond / 60, ValueFormat.LongTime);
                    var textLayout   = ChallengeRiftTimerFont.GetTextLayout(text);
                    if (!Hud.Render.ChallengeRiftAheadPanelUiElement.Visible)
                    {
                        ChallengeRiftTimerFont.DrawText(textLayout, ui.Rectangle.Left + ((ui.Rectangle.Width - textLayout.Metrics.Width) / 2), ui.Rectangle.Bottom + (ui.Rectangle.Height * 0.4f));
                    }
                    else
                    {
                        ChallengeRiftTimerFont.DrawText(textLayout, ui.Rectangle.Left + ((ui.Rectangle.Width - textLayout.Metrics.Width) / 2), Hud.Render.ChallengeRiftAheadPanelUiElement.Rectangle.Bottom - (ui.Rectangle.Height * 0.7f));
                    }
                }
            }

            if (ChallengeRiftPercentEnabled)
            {
                var percent    = Hud.Game.RiftPercentage;
                var text       = percent.ToString("F1", CultureInfo.InvariantCulture) + "%";
                var textLayout = ChallengeRiftPercentFont.GetTextLayout(text);
                var x          = (float)(ui.Rectangle.Left + (ui.Rectangle.Width / 100.0f * percent)) - (textLayout.Metrics.Width / 2);
                var y          = ui.Rectangle.Top - (ui.Rectangle.Height * 0.7f) - textLayout.Metrics.Height;
                ChallengeRiftPercentFont.DrawText(textLayout, x, y);
            }

            if (NearMonsterProgressionEnabled && (Hud.Game.CurrentQuestProgress < Hud.Game.MaxQuestProgress))
            {
                var total      = CalculateNearMonsterProgression(NearMonsterProgressionRange) / Hud.Game.MaxQuestProgress * 100d;
                var text       = total.ToString("F2", CultureInfo.InvariantCulture) + "% in " + NearMonsterProgressionRange.ToString("F0") + " yards";
                var textLayout = NearMonsterProgressionFont.GetTextLayout(text);
                var x          = ui.Rectangle.Left + ((ui.Rectangle.Width - textLayout.Metrics.Width) / 2);
                var y          = ui.Rectangle.Top + ((ui.Rectangle.Height - textLayout.Metrics.Height) / 2) + 1;
                NearMonsterProgressionFont.DrawText(textLayout, x, y);
            }
        }
Beispiel #2
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (clipState != ClipState.BeforeClip)
            {
                return;
            }

            if ((Hud.Game.SpecialArea != SpecialArea.Rift) && (Hud.Game.SpecialArea != SpecialArea.GreaterRift) && (Hud.Game.SpecialArea != SpecialArea.ChallengeRift))
            {
                return;
            }

            if (Hud.Game.SpecialArea == SpecialArea.Rift)
            {
                var percent = Hud.Game.RiftPercentage;
                var ui      = Hud.Render.NephalemRiftBarUiElement;
                if (ui.Visible)
                {
                    var add = ui.Rectangle.Height / 10.0f;
                    if (NephalemRiftPercentEnabled)
                    {
                        var text       = percent.ToString("F1", CultureInfo.InvariantCulture) + "%";
                        var textLayout = NephalemRiftPercentFont.GetTextLayout(text);
                        var x          = (float)(ui.Rectangle.Left + ui.Rectangle.Width / 100.0f * percent) - textLayout.Metrics.Width / 2;
                        var y          = ui.Rectangle.Top - ui.Rectangle.Height * 0.2f - textLayout.Metrics.Height;
                        NephalemRiftPercentFont.DrawText(textLayout, x, y);
                    }

                    if (NearMonsterProgressionEnabled && (Hud.Game.CurrentQuestProgress < Hud.Game.MaxQuestProgress))
                    {
                        var total      = CalculateNearMonsterProgression(NearMonsterProgressionRange) / Hud.Game.MaxQuestProgress * 100d;
                        var text       = total.ToString("F2", CultureInfo.InvariantCulture) + "% in " + NearMonsterProgressionRange.ToString("F0") + " yards";
                        var textLayout = NearMonsterProgressionFont.GetTextLayout(text);
                        var x          = ui.Rectangle.Left + (ui.Rectangle.Width - textLayout.Metrics.Width) / 2;
                        var y          = ui.Rectangle.Top + (ui.Rectangle.Height - textLayout.Metrics.Height) / 2 + 1;
                        NearMonsterProgressionFont.DrawText(textLayout, x, y);
                    }
                }
            }

            if (Hud.Game.SpecialArea == SpecialArea.GreaterRift)
            {
                var ui = Hud.Render.GreaterRiftBarUiElement;
                if (ui.Visible)
                {
                    var secondsLeft = (Hud.Game.CurrentTimedEventEndTick - (double)Hud.Game.CurrentGameTick) / 60.0d;
                    if (GreaterRiftTimerEnabled && (secondsLeft > 0))
                    {
                        var text       = ValueToString(((long)(Hud.Game.CurrentTimedEventEndTick - Hud.Game.CurrentGameTick) * 1000 * TimeSpan.TicksPerMillisecond / 60), ValueFormat.LongTime);
                        var textLayout = GreaterRiftTimerFont.GetTextLayout(text);
                        GreaterRiftTimerFont.DrawText(textLayout, ui.Rectangle.Right - (float)(ui.Rectangle.Width / 900.0f * secondsLeft) - textLayout.Metrics.Width / 2, ui.Rectangle.Bottom + ui.Rectangle.Height * 0.7f);
                    }

                    if (GreaterRiftPercentEnabled)
                    {
                        var percent    = Hud.Game.RiftPercentage;
                        var text       = percent.ToString("F1", CultureInfo.InvariantCulture) + "%";
                        var textLayout = GreaterRiftPercentFont.GetTextLayout(text);
                        var x          = (float)(ui.Rectangle.Left + ui.Rectangle.Width / 100.0f * percent) - textLayout.Metrics.Width / 2;
                        var y          = ui.Rectangle.Top - ui.Rectangle.Height * 0.7f - textLayout.Metrics.Height;
                        GreaterRiftPercentFont.DrawText(textLayout, x, y);
                    }

                    if (NearMonsterProgressionEnabled && (Hud.Game.CurrentQuestProgress < Hud.Game.MaxQuestProgress))
                    {
                        var total      = CalculateNearMonsterProgression(NearMonsterProgressionRange) / Hud.Game.MaxQuestProgress * 100d;
                        var text       = total.ToString("F2", CultureInfo.InvariantCulture) + "% in " + NearMonsterProgressionRange.ToString("F0") + " yards";
                        var textLayout = NearMonsterProgressionFont.GetTextLayout(text);
                        var x          = ui.Rectangle.Left + (ui.Rectangle.Width - textLayout.Metrics.Width) / 2;
                        var y          = ui.Rectangle.Top + (ui.Rectangle.Height - textLayout.Metrics.Height) / 2 + 1;
                        NearMonsterProgressionFont.DrawText(textLayout, x, y);
                    }
                }
            }

            if (Hud.Game.SpecialArea == SpecialArea.ChallengeRift)
            {
                var ui = Hud.Render.ChallengeRiftBarUiElement;
                if (ui.Visible)
                {
                    var secondsLeft = (Hud.Game.CurrentTimedEventEndTick - (double)Hud.Game.CurrentGameTick) / 60.0d;
                    if (ChallengeRiftTimerEnabled && (secondsLeft > 0))
                    {
                        var totalSeconds = (Hud.Game.CurrentTimedEventEndTick - Hud.Game.CurrentTimedEventStartTick) / 60.0d;
                        var text         = ValueToString(((long)(Hud.Game.CurrentTimedEventEndTick - Hud.Game.CurrentGameTick) * 1000 * TimeSpan.TicksPerMillisecond / 60), ValueFormat.LongTime);
                        var textLayout   = ChallengeRiftTimerFont.GetTextLayout(text);
                        if (!Hud.Render.ChallengeRiftAheadPanelUiElement.Visible)
                        {
                            ChallengeRiftTimerFont.DrawText(textLayout, ui.Rectangle.Left + (ui.Rectangle.Width - textLayout.Metrics.Width) / 2, ui.Rectangle.Bottom + ui.Rectangle.Height * 0.4f);
                        }
                        else
                        {
                            ChallengeRiftTimerFont.DrawText(textLayout, ui.Rectangle.Left + (ui.Rectangle.Width - textLayout.Metrics.Width) / 2, Hud.Render.ChallengeRiftAheadPanelUiElement.Rectangle.Bottom - ui.Rectangle.Height * 0.7f);
                        }
                    }

                    if (ChallengeRiftPercentEnabled)
                    {
                        var percent    = Hud.Game.RiftPercentage;
                        var text       = percent.ToString("F1", CultureInfo.InvariantCulture) + "%";
                        var textLayout = ChallengeRiftPercentFont.GetTextLayout(text);
                        var x          = (float)(ui.Rectangle.Left + ui.Rectangle.Width / 100.0f * percent) - textLayout.Metrics.Width / 2;
                        var y          = ui.Rectangle.Top - ui.Rectangle.Height * 0.7f - textLayout.Metrics.Height;
                        ChallengeRiftPercentFont.DrawText(textLayout, x, y);
                    }

                    if (NearMonsterProgressionEnabled && (Hud.Game.CurrentQuestProgress < Hud.Game.MaxQuestProgress))
                    {
                        var total      = CalculateNearMonsterProgression(NearMonsterProgressionRange) / Hud.Game.MaxQuestProgress * 100d;
                        var text       = total.ToString("F2", CultureInfo.InvariantCulture) + "% in " + NearMonsterProgressionRange.ToString("F0") + " yards";
                        var textLayout = NearMonsterProgressionFont.GetTextLayout(text);
                        var x          = ui.Rectangle.Left + (ui.Rectangle.Width - textLayout.Metrics.Width) / 2;
                        var y          = ui.Rectangle.Top + (ui.Rectangle.Height - textLayout.Metrics.Height) / 2 + 1;
                        NearMonsterProgressionFont.DrawText(textLayout, x, y);
                    }
                }
            }
        }