Example #1
0
        public void PaintWorld(WorldLayer layer)
        {
            if (Hud.Game.NumberOfPlayersInGame > 1 && Hud.Render.GetUiElement("Root.NormalLayer.rift_dialog_mainPage").Visible)
            {
                int maxGRlevel = 0;
                foreach (var player in Hud.Game.Players)
                {
                    maxGRlevel += player.HighestSoloRiftLevel;
                }

                int GRAverage = Convert.ToInt32(Convert.ToDouble(maxGRlevel / Hud.Game.NumberOfPlayersInGame + (((1 + Math.Sqrt(5)) / 2) * (Hud.Game.NumberOfPlayersInGame - 1))));
                GRLevelText = GRAverage.ToString();
                var uiRect = Hud.Render.GetUiElement("Root.NormalLayer.rift_dialog_mainPage").Rectangle;
                GRLevelDecorator.Paint(uiRect.Left, uiRect.Top, uiRect.Width, uiRect.Height, HorizontalAlign.Right);
            }
        }
Example #2
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);
                    }
                }
            }
        }
Example #4
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (clipState != ClipState.BeforeClip)
            {
                return;
            }
            if (!Hud.Game.Me.IsInTown)
            {
                return;
            }

            // Show the infomation only when the mouse cursor is within the healthBall area
            var uiRect = Hud.Render.GetUiElement("Root.NormalLayer.game_dialog_backgroundScreenPC.game_progressBar_healthBall").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))
            {
                return;
            }

            PlayersArrayInitialization();

            var cnt = 0;

            foreach (var player in Hud.Game.Players.OrderBy(p => p.PortraitIndex))
            {
                Players[cnt, 0] = player.BattleTagAbovePortrait.ToString().Trim();
                cnt++;
            }
            // Check whether the members of the current party are changed
            for (int i = 0; i < Players.GetLength(0); i++)
            {
                if (Players[i, 0] != pPlayers[i])
                {
                    IsPlayerChanged = true;
                    break;
                }
            }

            if (IsPlayerChanged)                        // Do it only when the party members are changed or just bypass it and show the existing data
            {
                Battletags   = string.Empty;
                Paragons     = string.Empty;
                ZClasses     = string.Empty;
                DPS          = string.Empty;
                HighestSolos = string.Empty;
                GR4PRanking  = string.Empty;
                GR4PLevel    = string.Empty;
                GR4PClass    = string.Empty;

                for (int i = 0; i < Players.GetLength(0); i++)
                {
                    pPlayers[i] = Players[i, 0];
                }

                SearchGRLevel();                                // put the party members' 4p data into array

                var pCnt = 0;
                foreach (var player in Hud.Game.Players.OrderBy(p => p.PortraitIndex))
                {
                    string Battletag = Players[pCnt, 0];
                    if (Players[pCnt, 1] != string.Empty)
                    {
                        Battletag += "#" + Players[pCnt, 1];
                    }
                    string Paragon = checked ((int)player.CurrentLevelParagon).ToString();
                    string Dps     = string.Empty;
                    if (player.Offense.SheetDps > 0f)
                    {
                        Dps = ValueToString((long)player.Offense.SheetDps, ValueFormat.LongNumber).Trim();
                    }
                    string ZClass = string.Empty;
                    if (IsZDPS(player))
                    {
                        ZClass           = "Z";
                        Players[pCnt, 5] = "Z";
                    }
                    ZClass          += player.HeroClassDefinition.Name;
                    Players[pCnt, 6] = player.HighestHeroSoloRiftLevel.ToString();
                    string HighestSolo = player.HighestHeroSoloRiftLevel.ToString().PadLeft(3);
                    string GR4Pranking = Players[pCnt, 2];
                    Match  match       = Regex.Match(Players[pCnt, 3], @"\d{1,}");              // extract numbers only
                    string GR4Plevel   = match.Value;
                    string GR4Pclass   = Players[pCnt, 4];

                    pCnt++;

                    if (culture == "ko")
                    {
                        TitleStr = "이름               파라곤    직업        DPS    솔플   4P순위  4P레벨  4P직업";
                    }
                    else
                    {
                        TitleStr = "BattleTag          Paragon   Class      DPS    Solo   4PRank  4PLevel 4PClass";
                    }
                    Battletags = (Battletags.Length == 0) ? Battletag : Battletags + Environment.NewLine + Battletag;
                    Paragons   = (Paragons.Length == 0) ? Paragon : Paragons + Environment.NewLine + Paragon;
                    ZClasses   = (ZClasses.Length == 0) ? ZClass : ZClasses + Environment.NewLine + ZClass;
                    DPS        = (DPS.Length == 0) ? Dps : DPS + Environment.NewLine + Dps;
                    if (player.HighestHeroSoloRiftLevel == 0)
                    {
                        IsPlayerChanged = true;
                        HighestSolo     = "???".PadLeft(3);
                    }
                    HighestSolos = (HighestSolos.Length == 0) ? HighestSolo : HighestSolos + Environment.NewLine + HighestSolo;
                    GR4PRanking  = (GR4PRanking.Length == 0) ? GR4Pranking : GR4PRanking + Environment.NewLine + GR4Pranking;
                    GR4PLevel    = (GR4PLevel.Length == 0) ? GR4Plevel : GR4PLevel + Environment.NewLine + GR4Plevel;
                    GR4PClass    = (GR4PClass.Length == 0) ? GR4Pclass : GR4PClass + Environment.NewLine + GR4Pclass;

                    // to recommend speedy hybrid GR level
                    bool Success;
                    int  number;
                    var  tmpLevel = 0;
                    cnt = 0;
                    var zflag = false;
                    for (int i = 0; i < Players.GetLength(0); i++)
                    {
                        if (Players[i, 5] != "Z")                                //if not Z class
                        {
                            Success = Int32.TryParse(Players[i, 6], out number); // Solo GR Highest level
                            if (Success && number > 0 && number < 200)           // solo hightest GR level : 1~ 199
                            {
                                tmpLevel += number;
                                cnt++;
                            }
                        }
                        else
                        {
                            zflag = true;
                        }
                    }
                    int tmpNo = 0;
                    if (cnt == 0)
                    {
                        cnt = 1;
                    }
                    tmpNo = (int)(tmpLevel / cnt);
                    int pCount = Hud.Game.Players.Count();
                    // R level will depend on the number of the party members and the presence of a zclass in the party
                    if (!zflag)                         // if no zclass
                    {
                        tmpNo -= (5 + (4 - pCount));
                    }
                    if (tmpNo < 0)
                    {
                        tmpNo = 0;
                    }
                    GRLevelSpeedHybrid = UnitDigitRound(tmpNo).ToString();

                    // to recommend speedy standard GR level
                    tmpLevel = 0;
                    cnt      = 0;
                    for (int i = 0; i < Players.GetLength(0); i++)
                    {
                        Success = Int32.TryParse(Players[i, 3], out number);                                    // 4P GR Highest level
                        if (Success && number > 0 && number < 200)                                              // solo hightest GR level : 1~ 199
                        {
                            tmpLevel += number;
                            cnt++;
                        }
                    }
                    if (cnt == 0)
                    {
                        cnt = 1;
                    }
                    tmpNo = (int)(tmpLevel / cnt) - 10;
                    if (tmpNo < 0)
                    {
                        tmpNo = 0;
                    }
                    GRLevelSpeedStandard = UnitDigitRound(tmpNo).ToString();
                }
            }

            TitleDecorator.Paint(BaseX, BaseY - 15, 350, 15, HorizontalAlign.Left);                     // Title

            ContentDecorator.TextFunc = () => Battletags;
            ContentDecorator.Paint(BaseX, BaseY, 50, 80, HorizontalAlign.Left);
            ContentDecorator.TextFunc = () => Paragons;
            ContentDecorator.Paint(BaseX + 150, BaseY, 50, 80, HorizontalAlign.Left);
            ContentDecorator.TextFunc = () => ZClasses;
            ContentDecorator.Paint(BaseX + 220, BaseY, 50, 80, HorizontalAlign.Left);
            ContentDecorator.TextFunc = () => DPS;
            ContentDecorator.Paint(BaseX + 310, BaseY - 5, 50, 90, HorizontalAlign.Left);
            ContentDecorator.TextFunc = () => HighestSolos;
            ContentDecorator.Paint(BaseX + 370, BaseY, 30, 80, HorizontalAlign.Left);
            ContentDecorator.TextFunc = () => GR4PRanking;
            ContentDecorator.Paint(BaseX + 430, BaseY, 30, 80, HorizontalAlign.Left);
            ContentDecorator.TextFunc = () => GR4PLevel;
            ContentDecorator.Paint(BaseX + 490, BaseY, 30, 80, HorizontalAlign.Left);
            ContentDecorator.TextFunc = () => GR4PClass;
            ContentDecorator.Paint(BaseX + 550, BaseY, 30, 80, HorizontalAlign.Left);

            if (Hud.Game.NumberOfPlayersInGame > 0)
            {
                GRLevelDecorator.Paint(BaseX, BaseY + 100, 530, 35, HorizontalAlign.Center);                                            // Recommended GR Level for speedy game
            }
        }