示例#1
0
        // GR level adviser part
        public void PaintTopInGame(ClipState clipState)
        {
            int maxGRlevel  = 0;
            int maxGRlevelZ = 0;

            PlayerInTownCount = 0;
            Battletags        = string.Empty;
            ZClasses          = string.Empty;
            HighestSolos      = string.Empty;
            NumberOfZplayers  = 0;

            foreach (var player in Hud.Game.Players)
            {
                if (!IsZDPS(player))
                {
                    var SheetDPS      = player.Offense.SheetDps;
                    var DPSmaxGRlevel = SheetDPSToGRLevel(SheetDPS);
                    if (DPSmaxGRlevel < player.HighestHeroSoloRiftLevel)
                    {
                        DPSmaxGRlevel = player.HighestHeroSoloRiftLevel;
                    }
                    maxGRlevel += DPSmaxGRlevel;
                }
                else
                {
                    var EHP = player.Defense.EhpMax;
                    maxGRlevelZ += EHPToGRLevel(EHP);
                    NumberOfZplayers++;
                }

                if (player.IsInTown)
                {
                    PlayerInTownCount++;
                }
                string Battletag = player.BattleTagAbovePortrait;

                string DPS = string.Empty;
                if (player.Offense.SheetDps >= 3000000f)
                {
                    DPS = ValueToString((long)player.Offense.SheetDps, ValueFormat.LongNumber);
                }
                int    WhiteSpaceNumber = 12 - player.HeroClassDefinition.HeroClass.ToString().Length;
                string WhiteSpaces      = new String(' ', WhiteSpaceNumber);

                string ZClass      = (IsZDPS(player)) ? "Z " + player.HeroClassDefinition.HeroClass  : player.HeroClassDefinition.HeroClass + WhiteSpaces + DPS;
                string HighestSolo = (IsZDPS(player)) ? EHPToGRLevel(player.Defense.EhpMax).ToString().PadLeft(3) : (SheetDPSToGRLevel(player.Offense.SheetDps) < player.HighestHeroSoloRiftLevel) ? player.HighestHeroSoloRiftLevel.ToString().PadLeft(3) : SheetDPSToGRLevel(player.Offense.SheetDps).ToString().PadLeft(3);
                if (player.SnoArea.Sno != Hud.Game.Me.SnoArea.Sno && player.HighestHeroSoloRiftLevel == 0)
                {
                    HighestSolo = "???".PadLeft(3);
                }
                Battletags   = (Battletags.Length == 0) ? Battletag : Battletags + Environment.NewLine + Battletag;
                ZClasses     = (ZClasses.Length == 0) ? ZClass : ZClasses + Environment.NewLine + ZClass;
                HighestSolos = (HighestSolos.Length == 0) ? HighestSolo : HighestSolos + Environment.NewLine + HighestSolo;
            }

            if (Hud.Render.GetUiElement("Root.NormalLayer.rift_dialog_mainPage").Visible)
            {
                int maxGRlevels = 0;
                int nonZplayers = (Hud.Game.NumberOfPlayersInGame - NumberOfZplayers);

                if (nonZplayers == 0)
                {
                    nonZplayers = 1;
                }

                if (maxGRlevelZ > maxGRlevel)
                {
                    maxGRlevels = maxGRlevel + ((maxGRlevel / nonZplayers) * NumberOfZplayers);
                }
                else
                {
                    maxGRlevels = maxGRlevel + maxGRlevelZ;
                }


                int GRAverage = Convert.ToInt32(Convert.ToDouble(maxGRlevels / Hud.Game.NumberOfPlayersInGame + (((1 + Math.Sqrt(5)) / 2) * (Hud.Game.NumberOfPlayersInGame - 1))));

                GRLevelText = GRAverage.ToString();
                if (NumberOfZplayers == Hud.Game.NumberOfPlayersInGame)
                {
                    GRLevelText = "Zero DPS party?";
                }
                else if (NumberOfZplayers == 0 && Hud.Game.NumberOfPlayersInGame != 1)
                {
                    GRLevelText = GRAverage + " no sup!";
                }
                else if (NumberOfZplayers == (Hud.Game.NumberOfPlayersInGame - 1) && Hud.Game.NumberOfPlayersInGame == 4)
                {
                    GRLevelText = GRAverage + " 3 sup!";
                }
                var uiRect = Hud.Render.GetUiElement("Root.NormalLayer.rift_dialog_mainPage").Rectangle;
                if (Hud.Window.CursorY >= uiRect.Top && Hud.Window.CursorY <= (uiRect.Top + uiRect.Height) && Hud.Window.CursorX >= uiRect.Left && Hud.Window.CursorX <= (uiRect.Left + uiRect.Width))
                {
                    float WeirdMathMagic = 2.8f;
                    if (Hud.Game.NumberOfPlayersInGame == 4)
                    {
                        WeirdMathMagic = 2.7f;
                    }
                    else if (Hud.Game.NumberOfPlayersInGame == 3)
                    {
                        WeirdMathMagic = 2.766f;
                    }
                    else if (Hud.Game.NumberOfPlayersInGame == 2)
                    {
                        WeirdMathMagic = 2.833f;
                    }
                    else if (Hud.Game.NumberOfPlayersInGame == 1)
                    {
                        WeirdMathMagic = 2.9f;
                    }
                    BattletagsDecorator.Paint((int)(uiRect.Right / 4), (int)(uiRect.Bottom / WeirdMathMagic), 50, 50, HorizontalAlign.Left);
                    ZClassesDecorator.Paint((int)(uiRect.Right / 2.1), (int)(uiRect.Bottom / WeirdMathMagic), 50, 50, HorizontalAlign.Left);
                    HighestSolosDecorator.Paint((int)(uiRect.Right / 1.38), (int)(uiRect.Bottom / WeirdMathMagic), 50, 50, HorizontalAlign.Left);
                    if (Hud.Game.NumberOfPlayersInGame != 1)
                    {
                        GRLevelDecorator.Paint((int)(uiRect.Right / 4), (int)(uiRect.Bottom / 2.15), 230, 38, HorizontalAlign.Left);
                    }
                }
            }

            // time to Grift boss part
            if (clipState != ClipState.BeforeClip)
            {
                return;
            }
            var GriftBar = Hud.Render.GreaterRiftBarUiElement;

            if (GriftBar.Visible && TimeToGRBoss)
            {
                var RiftPercentage = Hud.Game.RiftPercentage;
                if (RiftPercentage == 0)
                {
                    RiftPercentage = 1;
                }
                var GriftStart   = Hud.Game.CurrentTimedEventStartTick;
                var Now          = Hud.Game.CurrentGameTick;
                var TimeEllapsed = Now - GriftStart;
                var TimeToBoss   = (TimeEllapsed / RiftPercentage) * (100 - RiftPercentage);
                var text         = ValueToString((long)(TimeToBoss) * 1000 * TimeSpan.TicksPerMillisecond / 60, ValueFormat.LongTime);
                var textLayout   = GRTimeFont.GetTextLayout(text);
                var secondsLeft  = (Hud.Game.CurrentTimedEventEndTick - Hud.Game.CurrentTimedEventEndTickMod - (double)Hud.Game.CurrentGameTick) / 60.0d;
                if (secondsLeft < 180 && Position < 900)
                {
                    Position += 5;
                }
                else if (Position > 1)
                {
                    Position -= 5;
                }
                var BossTexture = Hud.Texture.GetTexture(3153276977);
                var BossDead    = Hud.Texture.GetTexture(3692681898);
                var Boss        = Hud.Game.AliveMonsters.FirstOrDefault(x => x.Rarity == ActorRarity.Boss);

                if (Boss != null && !BossSpawned)
                {
                    BossFightStart = Hud.Game.CurrentGameTick;
                    BossSpawned    = true;
                }

                if (Boss == null)
                {
                    BossSpawned = false;
                }

                if (TimeToBoss != 0)
                {
                    BossTexture.Draw(GriftBar.Rectangle.Right - (float)(GriftBar.Rectangle.Width / 900.0f * Position) - (textLayout.Metrics.Width / 2), GriftBar.Rectangle.Bottom - (GriftBar.Rectangle.Height * 0.2f), 45.0f, 45.0f, 1f);
                    GRTimeFont.DrawText(textLayout, GriftBar.Rectangle.Right - (float)(GriftBar.Rectangle.Width / 900.0f * Position) - (textLayout.Metrics.Width / 2), GriftBar.Rectangle.Bottom + (GriftBar.Rectangle.Height * 0.7f));
                }
                else if (Boss != null)
                {
                    var MaxHealth      = Boss.MaxHealth;
                    var CurHealth      = Boss.CurHealth;
                    var LifePercentage = (CurHealth / MaxHealth) * 100;
                    TimeEllapsed = Now - BossFightStart;
                    var TimeToEnd = (TimeEllapsed / (100 - LifePercentage)) * (LifePercentage);
                    text       = ValueToString((long)(TimeToEnd) * 1000 * TimeSpan.TicksPerMillisecond / 60, ValueFormat.LongTime);
                    textLayout = GRTimeFont.GetTextLayout(text);
                    if (TimeToEnd != 0 && LifePercentage < 100)
                    {
                        BossDead.Draw(GriftBar.Rectangle.Right - (float)(GriftBar.Rectangle.Width / 900.0f * Position) - (textLayout.Metrics.Width / 2), GriftBar.Rectangle.Bottom - (GriftBar.Rectangle.Height * 0.2f), 45.0f, 45.0f, 1f);
                        GRTimeFont.DrawText(textLayout, GriftBar.Rectangle.Right - (float)(GriftBar.Rectangle.Width / 900.0f * Position) - (textLayout.Metrics.Width / 2), GriftBar.Rectangle.Bottom + (GriftBar.Rectangle.Height * 0.7f));
                    }
                }
            }
        }
        public void PaintTopInGame(ClipState clipState)
        {
            int maxGRlevel = 0;

            PlayerInTownCount = 0;
            int NonZPlayerCount = 0;

            Battletags   = string.Empty;
            ZClasses     = string.Empty;
            HighestSolos = string.Empty;

            foreach (var player in Hud.Game.Players)
            {
                if (!IsZDPS(player))
                {
                    maxGRlevel += player.HighestHeroSoloRiftLevel;
                    NonZPlayerCount++;
                }
                if (player.IsInTown)
                {
                    PlayerInTownCount++;
                }
                string Battletag = player.BattleTagAbovePortrait;

                string DPS = string.Empty;
                if (player.Offense.SheetDps >= 3000000f)
                {
                    DPS = ValueToString((long)player.Offense.SheetDps, ValueFormat.LongNumber);
                }
                int    WhiteSpaceNumber = 12 - player.HeroClassDefinition.HeroClass.ToString().Length;
                string WhiteSpaces      = new String(' ', WhiteSpaceNumber);

                string ZClass      = (IsZDPS(player)) ? "Z " + player.HeroClassDefinition.HeroClass  : player.HeroClassDefinition.HeroClass + WhiteSpaces + DPS;
                string HighestSolo = player.HighestHeroSoloRiftLevel.ToString().PadLeft(3);
                if (player.SnoArea.Sno != Hud.Game.Me.SnoArea.Sno && player.HighestHeroSoloRiftLevel == 0)
                {
                    HighestSolo = "???".PadLeft(3);
                }
                Battletags   = (Battletags.Length == 0) ? Battletag : Battletags + Environment.NewLine + Battletag;
                ZClasses     = (ZClasses.Length == 0) ? ZClass : ZClasses + Environment.NewLine + ZClass;
                HighestSolos = (HighestSolos.Length == 0) ? HighestSolo : HighestSolos + Environment.NewLine + HighestSolo;
            }

            if (Hud.Render.GetUiElement("Root.NormalLayer.rift_dialog_mainPage").Visible)
            {
                if (NonZPlayerCount == 0)
                {
                    NonZPlayerCount = 1;
                }
                int GRAverage = Convert.ToInt32(Convert.ToDouble(maxGRlevel / NonZPlayerCount + (((1 + Math.Sqrt(5)) / 2) * (Hud.Game.NumberOfPlayersInGame - 1))));
                GRLevelText = GRAverage.ToString();
                var uiRect = Hud.Render.GetUiElement("Root.NormalLayer.rift_dialog_mainPage").Rectangle;
                if (Hud.Window.CursorY >= uiRect.Top && Hud.Window.CursorY <= (uiRect.Top + uiRect.Height) && Hud.Window.CursorX >= uiRect.Left && Hud.Window.CursorX <= (uiRect.Left + uiRect.Width))
                {
                    float WeirdMathMagic = 2.8f;
                    if (Hud.Game.NumberOfPlayersInGame == 4)
                    {
                        WeirdMathMagic = 2.7f;
                    }
                    else if (Hud.Game.NumberOfPlayersInGame == 3)
                    {
                        WeirdMathMagic = 2.766f;
                    }
                    else if (Hud.Game.NumberOfPlayersInGame == 2)
                    {
                        WeirdMathMagic = 2.833f;
                    }
                    else if (Hud.Game.NumberOfPlayersInGame == 1)
                    {
                        WeirdMathMagic = 2.9f;
                    }
                    BattletagsDecorator.Paint((int)(uiRect.Right / 4), (int)(uiRect.Bottom / WeirdMathMagic), 50, 50, HorizontalAlign.Left);
                    ZClassesDecorator.Paint((int)(uiRect.Right / 2.1), (int)(uiRect.Bottom / WeirdMathMagic), 50, 50, HorizontalAlign.Left);
                    HighestSolosDecorator.Paint((int)(uiRect.Right / 1.38), (int)(uiRect.Bottom / WeirdMathMagic), 50, 50, HorizontalAlign.Left);
                    if (Hud.Game.NumberOfPlayersInGame != 1)
                    {
                        GRLevelDecorator.Paint((int)(uiRect.Right / 4), (int)(uiRect.Bottom / 2.15), 230, 38, HorizontalAlign.Left);
                    }
                }
            }
        }