private void DrawHealthBar(WorldLayer layer, IMonster m, ref float yref)
        {
            var    w      = m.CurHealth * w2 / m.MaxHealth;
            var    per    = LightFont.GetTextLayout((m.CurHealth * 100 / m.MaxHealth).ToString(PercentageDescriptor) + "%");
            var    y      = YPos + py * 8 * yref;
            IBrush cBrush = null;
            IFont  cFont  = null;

            //Brush selection
            switch (m.Rarity)
            {
            case ActorRarity.Boss:
                cBrush = BossBrush;
                break;

            case ActorRarity.Champion:
                cBrush = ChampionBrush;
                break;

            case ActorRarity.Rare:
                cBrush = RareBrush;
                break;

            case ActorRarity.RareMinion:
                cBrush = RareMinionBrush;
                break;

            default:
                cBrush = BackgroundBrush;
                break;
            }

            //Jugger Highlight
            if (JuggernautHighlight && m.Rarity == ActorRarity.Rare && HasAffix(m, MonsterAffix.Juggernaut))
            {
                cFont  = RedFont;
                cBrush = RareJuggerBrush;
            }
            else
            {
                cFont = NameFont;
            }


            //Draw Rectangles
            BackgroundBrush.DrawRectangle(XPos, y, w2, h);
            BorderBrush.DrawRectangle(XPos, y, w2, h);
            cBrush.DrawRectangle(XPos, y, (float)w, h);
            LightFont.DrawText(per, XPos + 8 + w2, y - py);

            //Draw MonsterType
            if (ShowMonsterType)
            {
                var name = cFont.GetTextLayout(m.SnoMonster.NameLocalized);
                cFont.DrawText(name, XPos + 3, y - py);
            }

            //increase linecount
            yref += 1.0f;
        }
Exemplo n.º 2
0
        public void PaintExpandedHint(float x, float y, float w, float h, HorizontalAlign align)
        {
            if (!Enabled)
            {
                return;
            }
            if (ExpandedHintFont == null)
            {
                return;
            }

            var hint = HintFunc != null?HintFunc.Invoke() : null;

            if (string.IsNullOrEmpty(hint))
            {
                return;
            }

            if (BackgroundTexture1 != null)
            {
                BackgroundTexture1.Draw(x, y, w, h, BackgroundTextureOpacity1);
            }

            if (BackgroundTexture2 != null)
            {
                BackgroundTexture2.Draw(x, y, w, h, BackgroundTextureOpacity2);
            }

            if (BackgroundBrush != null)
            {
                BackgroundBrush.DrawRectangle(x, y, w, h);
            }

            var layout = ExpandedHintFont.GetTextLayout(hint);

            switch (align)
            {
            case HorizontalAlign.Left:
                ExpandedHintFont.DrawText(layout, x, y + (h - layout.Metrics.Height) / 2);
                break;

            case HorizontalAlign.Center:
                ExpandedHintFont.DrawText(layout, x + (w - layout.Metrics.Width) / 2, y + (h - layout.Metrics.Height) / 2);
                break;

            case HorizontalAlign.Right:
                ExpandedHintFont.DrawText(layout, x + w - layout.Metrics.Width, y + (h - layout.Metrics.Height) / 2);
                break;
            }

            if (BorderBrush != null)
            {
                BorderBrush.DrawRectangle(x, y, w, h);
            }
        }
Exemplo n.º 3
0
        private void DrawLabel(IBrush label, string buffText)
        {
            _activeBuffsCount++;
            _yPosTemp += YPosIncrement * SizeModifier;
            float xJump = CalculateJump();

            BorderBrush.DrawRectangle(hudWidth * _xPosTemp - (lWidth * 1.05f * .5f) + xJump, hudHeight * _yPosTemp - lHeight * 1.1f, lWidth * 1.05f, lHeight * 1.2f);
            label.DrawRectangle(hudWidth * _xPosTemp - lWidth * .5f + xJump, hudHeight * _yPosTemp - lHeight, lWidth, lHeight);

            var layout = TextFont.GetTextLayout(buffText);

            TextFont.DrawText(layout, hudWidth * _xPosTemp - (layout.Metrics.Width * 0.5f) + xJump, hudHeight * _yPosTemp - (layout.Metrics.Height * 1.1f));
        }
Exemplo n.º 4
0
        public void Paint(float x, float y, float w, float h, string text, string title = null, string hint = null)
        {
            if (!Enabled)
            {
                return;
            }
            if (TextFont == null)
            {
                return;
            }

            var displaySize         = Hud.Window.Size;
            var screenBorderPadding = 0.0f;

            if (BorderBrush != null)
            {
                screenBorderPadding += BorderBrush.RealStrokeWidth;
            }

            var layout = TextFont.GetTextLayout(text);

            var rect = new RectangleF(x, y, w, h);

            if (!string.IsNullOrEmpty(hint) && Hud.Window.CursorInsideRect(x, y, w, h))
            {
                Hud.Render.SetHint(hint);
            }

            if (BackgroundBrush != null)
            {
                BackgroundBrush.DrawRectangle(rect);
            }

            var realY = y;

            if ((TitleFont != null) && (BorderBrush != null) && !string.IsNullOrEmpty(title))
            {
                var titleLayout = TitleFont.GetTextLayout(title);
                var pad         = 3 * Hud.Window.Size.Height / 1200.0f;
                realY = y + pad + titleLayout.Metrics.Height + pad;
                BorderBrush.DrawLine(x, realY, x + w, realY);
                TitleFont.DrawText(titleLayout, x + (w - titleLayout.Metrics.Width) / 2, y + pad);
            }

            TextFont.DrawText(layout, x + (w - layout.Metrics.Width) / 2, realY + (h - (realY - y) - layout.Metrics.Height) / 2);

            if (BorderBrush != null)
            {
                BorderBrush.DrawRectangle(rect);
            }
        }
Exemplo n.º 5
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (clipState != ClipState.BeforeClip)
            {
                return;
            }
            if (!Hud.Game.IsInGame || Hud.Game.IsInTown)
            {
                return;
            }
            bool near = Hud.Game.Players.Where(p => !p.IsMe && p.HasValidActor && (p.HeroClassDefinition.HeroClass == Heroclass) && (p.CentralXyDistanceToMe <= Distance)).Any();

            (near?BackgroundBrush1:BackgroundBrush2).DrawRectangle(xPos, yPos, WidthRectangle, HeightRectangle);
            BorderBrush.DrawRectangle(xPos, yPos, WidthRectangle, HeightRectangle);
        }
Exemplo n.º 6
0
        private void DrawHealthBar(WorldLayer layer, IMonster m, ref float yref)
        {
            if (m.Rarity == ActorRarity.RareMinion && !ShowRareMinions)
            {
                return;                                                             //no minions
            }
            if (m.SummonerAcdDynamicId != 0)
            {
                return;                                                             //no clones
            }
            var    w      = m.CurHealth * w2 / m.MaxHealth;
            var    per    = LightFont.GetTextLayout((m.CurHealth * 100 / m.MaxHealth).ToString(PercentageDescriptor) + "%");
            var    y      = YPos + py * 8 * yref;
            IBrush cBrush = null;
            IFont  cFont  = null;

            //Brush selection
            switch (m.Rarity)
            {
            case ActorRarity.Boss:
                cBrush = BossBrush;
                break;

            case ActorRarity.Champion:
                cBrush = ChampionBrush;
                break;

            case ActorRarity.Rare:
                cBrush = RareBrush;
                break;

            case ActorRarity.RareMinion:
                cBrush = RareMinionBrush;
                break;

            default:
                cBrush = BackgroundBrush;
                break;
            }

            //Jugger Highlight
            if (JuggernautHighlight && m.Rarity == ActorRarity.Rare && HasAffix(m, MonsterAffix.Juggernaut))
            {
                cFont  = RedFont;
                cBrush = RareJuggerBrush;
            }
            else
            {
                cFont = NameFont;
            }

            //Missing Highlight
            if (MissingHighlight && (m.Rarity == ActorRarity.Champion || m.Rarity == ActorRarity.Rare) && !m.IsOnScreen)
            {
                var missing = RedFont.GetTextLayout("⚠");
                RedFont.DrawText(missing, XPos - 17, y - py);
            }

            //Circle Non-Clones and Boss
            //if (CircleNonIllusion && m.SummonerAcdDynamicId == 0 && HasAffix(m, MonsterAffix.Illusionist) || m.Rarity == ActorRarity.Boss && ShowBossHitBox)
            //        HitBoxDecorator.Paint(layer, m, m.FloorCoordinate, string.Empty);

            //Show Debuffs on Monster
            if (ShowDebuffAndCC)
            {
                string textDebuff = null;
                if (m.Locust)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Locust";
                }
                //if (m.Palmed) textDebuff += (textDebuff == null ? "" : ", ") + "Palm";
                if (m.Haunted)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Haunt";
                }
                if (m.MarkedForDeath)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Mark";
                }
                if (m.Strongarmed)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Strongarm";
                }
                string textCC = null;
                //if (m.Frozen) textCC += (textCC == null ? "" : ", ") + "Frozen";
                //if (m.Chilled) textCC += (textCC == null ? "" : ", ") + "Chill";
                //if (m.Slow) textCC += (textCC == null ? "" : ", ") + "Slow";
                //if (m.Stunned) textCC += (textCC == null ? "" : ", ") + "Stun";
                if (m.Invulnerable)
                {
                    textCC += (textCC == null ? "" : ", ") + "Invulnerable";
                }
                //if (m.Blind) textCC += (textCC == null ? "" : ", ") + "Blind";
                var d = LightFont.GetTextLayout(textDebuff + (textDebuff != null && textCC != null ? " | " : "") + textCC);
                LightFont.DrawText(d, XPos + 65 + w2, y - py);
            }

            //Draw Rectangles
            BackgroundBrush.DrawRectangle(XPos, y, w2, h);
            BorderBrush.DrawRectangle(XPos, y, w2, h);
            cBrush.DrawRectangle(XPos, y, (float)w, h);
            LightFont.DrawText(per, XPos + 8 + w2, y - py);

            //Draw MonsterType
            if (ShowMonsterType)
            {
                var name = cFont.GetTextLayout(m.SnoMonster.NameLocalized);
                cFont.DrawText(name, XPos + 3, y - py);
            }

            //increase linecount
            yref += 1.0f;
        }
Exemplo n.º 7
0
        public void PaintWorld(WorldLayer layer)
        {
            var w1           = Hud.Window.Size.Width * 0.00333f * b;
            var textLocust   = "虫群"; //"L"
            var layoutLocust = TextFontLocust.GetTextLayout(textLocust);
            var textHaunt    = "蚀魂"; //"H"
            var layoutHaunt  = TextFontHaunt.GetTextLayout(textHaunt);
            var h2           = Hud.Window.Size.Height * 0.017f;
            var x2           = Hud.Window.Size.Width * 0.001667f * b;
            var x3           = Hud.Window.Size.Width * 0.02f;


            var monsters = Hud.Game.AliveMonsters;

            foreach (var monster in monsters)
            {
                bool illusionist = false;
                if (monster.SummonerAcdDynamicId == 0)
                {
                    illusionist = false;
                }
                else
                {
                    illusionist = true;
                }
                if (monster.Rarity == ActorRarity.Champion)
                {
                    if (illusionist == false)
                    {
                        var hptext   = (monster.CurHealth * 100 / monster.MaxHealth).ToString("f0") + "%";
                        var layout   = TextFont.GetTextLayout(hptext);
                        var h        = Hud.Window.Size.Height * 0.00034f * 35;
                        var w        = monster.CurHealth * w1 / monster.MaxHealth;
                        var monsterX = monster.FloorCoordinate.ToScreenCoordinate().X; // - w1 / 2;
                        var monsterY = monster.FloorCoordinate.ToScreenCoordinate().Y; // + py * 14;
                        var locustX  = monsterX + x3 * 0.1f;
                        var hauntX   = monsterX - x3;
                        var buffY    = monsterY - h2 * 2f;
                        var hpX      = monsterX - 1.5f;
                        if (monster.Invulnerable)
                        {
                            BorderBrush.DrawRectangle(monsterX - x2, monsterY + h2, w1, h);
                        }
                        BackgroundBrush.DrawRectangle(monsterX - x2, monsterY + h2, w1, h);
                        if (monster.Rarity == ActorRarity.Champion)
                        {
                            ChampionBrush.DrawRectangle(monsterX - x2, monsterY + h2, (float)w, h);
                        }
                        if (monster.Locust)
                        {
                            TextFontLocust.DrawText(layoutLocust, locustX, buffY);
                        }
                        if (monster.Haunted)
                        {
                            TextFontHaunt.DrawText(layoutHaunt, hauntX, buffY);
                        }
                        TextFont.DrawText(layout, hpX, monsterY + h2 / 1.2f);
                    }
                }
                if (monster.Rarity == ActorRarity.Rare)
                {
                    if (illusionist == false)
                    {
                        var hptext   = (monster.CurHealth * 100 / monster.MaxHealth).ToString("f0") + "%";
                        var layout   = TextFont.GetTextLayout(hptext);
                        var h        = Hud.Window.Size.Height * 0.00034f * 35;
                        var w        = monster.CurHealth * w1 / monster.MaxHealth;
                        var monsterX = monster.FloorCoordinate.ToScreenCoordinate().X; // - w1 / 2;
                        var monsterY = monster.FloorCoordinate.ToScreenCoordinate().Y; // + py * 14;
                        var locustX  = monsterX + x3 * 0.1f;
                        var hauntX   = monsterX - x3;
                        var buffY    = monsterY - h2 * 2f;
                        var hpX      = monsterX - 1.5f;
                        if (monster.Invulnerable)
                        {
                            BorderBrush.DrawRectangle(monsterX - x2, monsterY + h2, w1, h);
                        }
                        BackgroundBrush.DrawRectangle(monsterX - x2, monsterY + h2, w1, h);
                        if (monster.Rarity == ActorRarity.Rare)
                        {
                            RareBrush.DrawRectangle(monsterX - x2, monsterY + h2, (float)w, h);
                        }
                        if (monster.Locust)
                        {
                            TextFontLocust.DrawText(layoutLocust, locustX, buffY);
                        }
                        if (monster.Haunted)
                        {
                            TextFontHaunt.DrawText(layoutHaunt, hauntX, buffY);
                        }
                        TextFont.DrawText(layout, hpX, monsterY + h2 / 1.2f);
                    }
                }
            }
        }
        public void PaintWorld(WorldLayer layer)
        {
            var             h             = 17;
            var             w1            = 30;
            var             textLocust    = "L";
            var             layoutLocust  = TextFontLocust.GetTextLayout(textLocust);
            var             textHaunt     = "H";
            var             layoutHaunt   = TextFontHaunt.GetTextLayout(textHaunt);
            var             py            = Hud.Window.Size.Height / 600;
            var             monsters      = Hud.Game.AliveMonsters.Where(x => x.IsAlive);
            List <IMonster> monstersElite = new List <IMonster>();

            foreach (var monster in monsters)
            {
                if (monster.SummonerAcdDynamicId == 0)
                {
                    if (monster.Rarity == ActorRarity.Champion || monster.Rarity == ActorRarity.Rare)
                    {
                        monstersElite.Add(monster);
                    }
                }
            }
            foreach (var monster in monstersElite)
            {
                var hptext   = ValueToString(monster.CurHealth * 100 / monster.MaxHealth, ValueFormat.NormalNumberNoDecimal);
                var layout   = TextFont.GetTextLayout(hptext);
                var w        = monster.CurHealth * w1 / monster.MaxHealth;
                var monsterX = monster.FloorCoordinate.ToScreenCoordinate().X - w1 / 2;
                var monsterY = monster.FloorCoordinate.ToScreenCoordinate().Y + py * 12;
                var locustX  = monsterX - w1 / 2;
                var hauntX   = monsterX + w1 + 5;
                var buffY    = monsterY - 1;
                var hpX      = monsterX + 7;

                BorderBrush.DrawRectangle(monsterX, monsterY, w1, h);
                BackgroundBrush.DrawRectangle(monsterX, monsterY, w1, h);
                if (monster.Rarity == ActorRarity.Champion)
                {
                    ChampionBrush.DrawRectangle(monsterX, monsterY, (float)w, h);
                }
                if (monster.Rarity == ActorRarity.Rare)
                {
                    bool flagJ = false;
                    foreach (var snoMonsterAffix in monster.AffixSnoList)
                    {
                        if (snoMonsterAffix.Affix == MonsterAffix.Juggernaut)
                        {
                            flagJ = true;
                            break;
                        }
                    }
                    if (flagJ)
                    {
                        RareJBrush.DrawRectangle(monsterX, monsterY, (float)w, h);
                    }
                    else
                    {
                        RareBrush.DrawRectangle(monsterX, monsterY, (float)w, h);
                    }
                }
                if (monster.Locust)
                {
                    TextFontLocust.DrawText(layoutLocust, locustX, buffY);
                }
                if (monster.Haunted)
                {
                    TextFontHaunt.DrawText(layoutHaunt, hauntX, buffY);
                }
                TextFont.DrawText(layout, hpX, buffY);
            }
            monstersElite.Clear();
        }
Exemplo n.º 9
0
        public void PaintWorld(WorldLayer layer)
        {
            var monsters = Hud.Game.AliveMonsters;
            Dictionary <IMonster, string> eliteGroup = new Dictionary <IMonster, string>();

            foreach (var monster in monsters)
            {
                if (monster.Rarity == ActorRarity.Champion || monster.Rarity == ActorRarity.Rare)
                {
                    if (eliteGroup.ContainsKey(monster))
                    {
                        eliteGroup[monster] = monster.SnoMonster.Priority.ToString() + monster.SnoMonster.Sno + monster.SnoMonster.NameEnglish + String.Join(", ", monster.AffixSnoList);
                    }
                    else
                    {
                        eliteGroup.Add(monster, monster.SnoMonster.Priority.ToString() + monster.SnoMonster.Sno + monster.SnoMonster.NameEnglish + String.Join(", ", monster.AffixSnoList));
                    }
                }
            }
            Dictionary <IMonster, string> eliteGroup1 = eliteGroup.OrderBy(p => p.Value).ToDictionary(p => p.Key, o => o.Value);
            var    px     = Hud.Window.Size.Width * 0.00125f;
            var    py     = Hud.Window.Size.Height * 0.001667f;
            var    h      = py * 5;
            var    w2     = py * 50;
            var    count  = 0;
            string preStr = null;

            //remove clone
            foreach (var elite in eliteGroup1)
            {
                if (elite.Key.Illusion)
                {
                    continue;
                }
                if (elite.Key.Rarity == ActorRarity.Champion)
                {
                    var x         = Hud.Window.Size.Width * 0.125f;
                    var w         = elite.Key.CurHealth * w2 / elite.Key.MaxHealth;
                    var affixlist = "";
                    foreach (var Affix in elite.Key.AffixSnoList)
                    {
                        affixlist = affixlist + " " + Affix.NameLocalized;
                    }
                    var text   = (elite.Key.CurHealth * 100 / elite.Key.MaxHealth).ToString("f1") + "% " + elite.Key.SnoMonster.NameLocalized + affixlist;
                    var layout = TextFont.GetTextLayout(text);
                    if (preStr != elite.Value || preStr == null)
                    {
                        count++;
                    }
                    var y = py * 8 * count;
                    if (elite.Key.Invulnerable)
                    {
                        BorderBrush.DrawRectangle(x, y, w2, h);
                    }
                    BackgroundBrush.DrawRectangle(x, y, w2, h);
                    TextFont.DrawText(layout, x + px + w2, y - py);
                    ChampionBrush.DrawRectangle(x, y, (float)w, h);
                    preStr = elite.Value;
                    count++;
                }
                if (elite.Key.Rarity == ActorRarity.Rare)
                {
                    var x         = Hud.Window.Size.Width * 0.125f;
                    var w         = elite.Key.CurHealth * w2 / elite.Key.MaxHealth;
                    var affixlist = "";
                    foreach (var Affix in elite.Key.AffixSnoList)
                    {
                        affixlist = affixlist + " " + Affix.NameLocalized;
                    }
                    var text   = (elite.Key.CurHealth * 100 / elite.Key.MaxHealth).ToString("f1") + "% " + elite.Key.SnoMonster.NameLocalized + affixlist;
                    var layout = TextFont.GetTextLayout(text);
                    if (preStr != elite.Value || preStr == null)
                    {
                        count++;
                    }
                    var y = py * 8 * count;
                    if (elite.Key.Invulnerable)
                    {
                        BorderBrush.DrawRectangle(x, y, w2, h);
                    }
                    BackgroundBrush.DrawRectangle(x, y, w2, h);
                    TextFont.DrawText(layout, x + px + w2, y - py);
                    RareBrush.DrawRectangle(x, y, (float)w, h);
                    preStr = elite.Value;
                    count++;
                }
            }
            eliteGroup.Clear();
            eliteGroup1.Clear();
        }
Exemplo n.º 10
0
        private void DrawHealthBar(WorldLayer layer, IMonster m, ref float yref)
        {
            if (m.Rarity == ActorRarity.RareMinion && !ShowRareMinions)
            {
                return;                                                             //no minions
            }
            if (m.SummonerAcdDynamicId != 0)
            {
                return;                                                             //no clones
            }
            var wint = m.CurHealth / m.MaxHealth; string whptext;

            if ((wint < 0) || (wint > 1))
            {
                wint = 1; whptext = "bug";
            }
            else
            {
                whptext = (wint * 100).ToString(PercentageDescriptor) + "%";
            }
            var w   = wint * w2;
            var per = LightFont.GetTextLayout(whptext);

            var y = YPos + py * 8 * yref;

//            IBrush cBrush = null;
//            IFont cFont = null;
            cBrush = null;
            cFont  = null;

            //Brush selection
            switch (m.Rarity)
            {
            case ActorRarity.Boss:
                cBrush = BossBrush;
                break;

            case ActorRarity.Champion:
                cBrush = ChampionBrush;
                break;

            case ActorRarity.Rare:
                cBrush = RareBrush;
                break;

            case ActorRarity.RareMinion:
                cBrush = RareMinionBrush;
                break;

            default:
                cBrush = BackgroundBrush;
                break;
            }

            //Jugger Highlight
            if (JuggernautHighlight && m.Rarity == ActorRarity.Rare && HasAffix(m, MonsterAffix.Juggernaut))
            {
                cFont  = RedFont;
                cBrush = RareJuggerBrush;
            }
            else
            {
                cFont = NameFont;
            }

            //Missing Highlight
            if (MissingHighlight && (m.Rarity == ActorRarity.Champion || m.Rarity == ActorRarity.Rare) && !m.IsOnScreen)
            {
                var missing = RedFont.GetTextLayout("\u26A0");
                RedFont.DrawText(missing, XPos - 17, y - py);
            }

            //Circle Non-Clones and Boss
            if (CircleNonIllusion && m.SummonerAcdDynamicId == 0 && HasAffix(m, MonsterAffix.Illusionist) || m.Rarity == ActorRarity.Boss && ShowBossHitBox)
            {
                HitBoxDecorator.Paint(layer, m, m.FloorCoordinate, string.Empty);
            }

            string d = string.Empty;

            //Show Debuffs on Monster
            if (ShowDebuffAndCC)
            {
                string textDebuff = null;
                if (m.Locust)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Locust";
                }
                if (m.Palmed)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Palm";
                }
                if (m.Haunted)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Haunt";
                }
                if (m.MarkedForDeath)
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Mark";
                }
                //if (m.Strongarmed) textDebuff += (textDebuff == null ? "" : ", ") + "Strongarm"; // No funciona, reemplazado por otro código
                if (m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_2_Visual_Effect_None, 318772) == 1) //318772  2   power: ItemPassive_Unique_Ring_590_x1
                {
                    textDebuff += (textDebuff == null ? "" : ", ") + "Strongarm";
                }
                string textCC = null;
                if (m.Frozen)
                {
                    textCC += (textCC == null ? "" : ", ") + "Frozen";
                }
                if (m.Chilled)
                {
                    textCC += (textCC == null ? "" : ", ") + "Chill";
                }
                if (m.Slow)
                {
                    textCC += (textCC == null ? "" : ", ") + "Slow";
                }
                if (m.Stunned)
                {
                    textCC += (textCC == null ? "" : ", ") + "Stun";
                }
                if (m.Invulnerable)
                {
                    textCC += (textCC == null ? "" : ", ") + "Invulnerable";
                }
                if (m.Blind)
                {
                    textCC += (textCC == null ? "" : ", ") + "Blind";
                }
                if (textDebuff != null)
                {
                    d = textDebuff;
                }
                if (textCC != null)
                {
                    d += ((d != string.Empty)? " | ":"") + textCC;
                }
            }
            if (ShowCurses)
            {
                string Curses = null;
                if (m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_2_Visual_Effect_None, 471845) == 1)     //471845 1 power: Frailty
                {
                    Curses += (Curses == null ? "" : " ") + "F";
                }
                if (m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_2_Visual_Effect_None, 471869) == 1)      //471869 1 power: Leech
                {
                    Curses += (Curses == null ? "" : " ") + "L";
                }
                if (m.GetAttributeValue(Hud.Sno.Attributes.Power_Buff_2_Visual_Effect_None, 471738) == 1)     //471738 1 power: Decrepify
                {
                    Curses += (Curses == null ? "" : " ") + "D";
                }
                if (Curses != null)
                {
                    d += ((d != string.Empty)? " | ":"") + Curses;
                }
            }
            if (d != string.Empty)
            {
                LightFont.DrawText(LightFont.GetTextLayout(d), XPos + 65 + w2, y - py);
            }

            //Draw Rectangles
            BackgroundBrush.DrawRectangle(XPos, y, w2, h);
            BorderBrush.DrawRectangle(XPos, y, w2, h);
            cBrush.DrawRectangle(XPos, y, (float)w, h);
            LightFont.DrawText(per, XPos + 8 + w2, y - py);

            //Draw MonsterType
            if (ShowMonsterType)
            {
                var name = cFont.GetTextLayout(m.SnoMonster.NameLocalized);
                cFont.DrawText(name, XPos + 3, y - py);
            }

            //increase linecount
            yref += 0.95f;
        }
Exemplo n.º 11
0
        public void Paint(float x, float y, float w, float h, HorizontalAlign align)
        {
            if (!Enabled)
            {
                return;
            }
            if (TextFont == null)
            {
                return;
            }

            var text = TextFunc != null?TextFunc.Invoke() : null;

            var hint = HintFunc != null?HintFunc.Invoke() : null;

            if (string.IsNullOrEmpty(text) && HideBackgroundWhenTextIsEmpty)
            {
                return;
            }

            if (Hud.Window.CursorInsideRect(x, y, w, h))
            {
                var expanded = false;
                if (ExpandUpLabels != null && ExpandUpLabels.Count > 0)
                {
                    var ly = y - h;
                    foreach (var label in ExpandUpLabels)
                    {
                        label.Paint(x, ly, w, h, align);
                        label.PaintExpandedHint(x + w, ly, w * label.ExpandedHintWidthMultiplier, h, HorizontalAlign.Center);
                        ly      -= h;
                        expanded = true;
                    }
                    this.PaintExpandedHint(x + w, y, w * 3, h, HorizontalAlign.Center);
                }
                if (ExpandDownLabels != null && ExpandDownLabels.Count > 0)
                {
                    var ly = y + h;
                    foreach (var label in ExpandDownLabels)
                    {
                        label.Paint(x, ly, w, h, align);
                        label.PaintExpandedHint(x + w, ly, w * label.ExpandedHintWidthMultiplier, h, HorizontalAlign.Center);
                        ly      += h;
                        expanded = true;
                    }
                    this.PaintExpandedHint(x + w, y, w * 3, h, HorizontalAlign.Center);
                }
                if (ExpandRightLabels != null && ExpandRightLabels.Count > 0)
                {
                    var lx = x + w;
                    foreach (var label in ExpandRightLabels)
                    {
                        label.Paint(lx, y, w, h, align);
                        lx      += h;
                        expanded = true;
                    }
                }
                if (ExpandLeftLabels != null && ExpandLeftLabels.Count > 0)
                {
                    var lx = x - w;
                    foreach (var label in ExpandLeftLabels)
                    {
                        label.Paint(lx, y, w, h, align);
                        lx      -= h;
                        expanded = true;
                    }
                }

                if (!expanded)
                {
                    if (!string.IsNullOrEmpty(hint))
                    {
                        Hud.Render.SetHint(hint);
                    }
                }
            }

            if (BackgroundTexture1 != null)
            {
                BackgroundTexture1.Draw(x, y, w, h, BackgroundTextureOpacity1);
            }

            if (BackgroundTexture2 != null)
            {
                BackgroundTexture2.Draw(x, y, w, h, BackgroundTextureOpacity2);
            }

            if (BackgroundBrush != null)
            {
                BackgroundBrush.DrawRectangle(x, y, w, h);
            }

            if (!string.IsNullOrEmpty(text))
            {
                var layout = TextFont.GetTextLayout(text);
                switch (align)
                {
                case HorizontalAlign.Left:
                    TextFont.DrawText(layout, x, y + (h - layout.Metrics.Height) / 2);
                    break;

                case HorizontalAlign.Center:
                    TextFont.DrawText(layout, x + (w - layout.Metrics.Width) / 2, y + (h - layout.Metrics.Height) / 2);
                    break;

                case HorizontalAlign.Right:
                    TextFont.DrawText(layout, x + w - layout.Metrics.Width, y + (h - layout.Metrics.Height) / 2);
                    break;
                }
            }

            if (BorderBrush != null)
            {
                BorderBrush.DrawRectangle(x, y, w, h);
            }
        }
Exemplo n.º 12
0
        public void PaintWorld(WorldLayer layer)
        {
            var players = Hud.Game.Players.Where(player => !player.IsMe && player.CoordinateKnown && (player.HeadStone == null));

            foreach (var player in players)
            {
                if (player == null)
                {
                    continue;
                }
                var ScreenWidth      = Hud.Window.Size.Width;
                var ScreenHeight     = Hud.Window.Size.Height;
                var HeroTexture      = Hud.Texture.GetTexture(890155253);
                var HPbarWidth       = (float)(ScreenWidth / 13);
                var HPbarHeight      = (float)(ScreenHeight / 130);
                var ResbarWidth      = (float)(ScreenWidth / 13);
                var ResbarHeight     = (float)(ScreenHeight / 200);
                var CurRes           = 0f;
                var CurRes2          = 0f;
                var ScreenCoordinate = player.FloorCoordinate.ToScreenCoordinate();
                var PlayerX          = ScreenCoordinate.X;
                var PlayerY          = ScreenCoordinate.Y;
                if (HPbar == true)
                {
                    var CurHealth = player.Defense.HealthCur / player.Defense.HealthMax;
                    BorderBrush.DrawRectangle(PlayerX - (float)HPbarWidth / 2, PlayerY - (float)(ScreenHeight / 16) / 2, HPbarWidth, HPbarHeight);
                    BackgroundBrush.DrawRectangle(PlayerX - (float)HPbarWidth / 2, PlayerY - (float)(ScreenHeight / 16) / 2, HPbarWidth, HPbarHeight);
                    HPbarBrush.DrawRectangle(PlayerX - (float)HPbarWidth / 2, PlayerY - (float)(ScreenHeight / 16) / 2, HPbarWidth * CurHealth, HPbarHeight);
                }

                if (player.HeroClassDefinition.HeroClass.ToString() == "Barbarian")
                {
                    if (Resbar == true)
                    {
                        CurRes = player.Stats.ResourceCurFury / player.Stats.ResourceMaxFury;
                        BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight);
                        FuryBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight);
                    }

                    if (player.HeroIsMale)
                    {
                        HeroTexture = Hud.Texture.GetTexture(3921484788);                    // male/female can't be determined, let's keep it for later...
                    }
                    else
                    {
                        HeroTexture = Hud.Texture.GetTexture(1030273087);
                    }
                }
                else if (player.HeroClassDefinition.HeroClass.ToString() == "Crusader")
                {
                    if (Resbar == true)
                    {
                        CurRes = player.Stats.ResourceCurWrath / player.Stats.ResourceMaxWrath;
                        BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight);
                        WrathBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight);
                    }
                    if (player.HeroIsMale)
                    {
                        HeroTexture = Hud.Texture.GetTexture(3742271755);
                    }
                    else
                    {
                        HeroTexture = Hud.Texture.GetTexture(3435775766);
                    }
                }
                else if (player.HeroClassDefinition.HeroClass.ToString() == "DemonHunter")
                {
                    if (Resbar == true)
                    {
                        CurRes  = player.Stats.ResourceCurHatred / player.Stats.ResourceMaxHatred;
                        CurRes2 = player.Stats.ResourceCurDiscipline / player.Stats.ResourceMaxDiscipline;
                        BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight);
                        HatreBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight);
                        BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 40) / 1.45f, ResbarWidth, ResbarHeight);
                        DisciplineBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 40) / 1.45f, ResbarWidth * CurRes2, ResbarHeight);
                    }
                    if (player.HeroIsMale)
                    {
                        HeroTexture = Hud.Texture.GetTexture(3785199803);
                    }
                    else
                    {
                        HeroTexture = Hud.Texture.GetTexture(2939779782);
                    }
                }
                else if (player.HeroClassDefinition.HeroClass.ToString() == "Monk")
                {
                    if (Resbar == true)
                    {
                        CurRes = player.Stats.ResourceCurSpirit / player.Stats.ResourceMaxSpirit;
                        BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight);
                        SpiritBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight);
                    }
                    if (player.HeroIsMale)
                    {
                        HeroTexture = Hud.Texture.GetTexture(2227317895);
                    }
                    else
                    {
                        HeroTexture = Hud.Texture.GetTexture(2918463890);
                    }
                }
                else if (player.HeroClassDefinition.HeroClass.ToString() == "Necromancer")
                {
                    if (Resbar == true)
                    {
                        CurRes = player.Stats.ResourceCurEssence / player.Stats.ResourceMaxEssence;
                        BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight);
                        EssenceBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight);
                    }
                    if (player.HeroIsMale)
                    {
                        HeroTexture = Hud.Texture.GetTexture(3285997023);
                    }
                    else
                    {
                        HeroTexture = Hud.Texture.GetTexture(473831658);
                    }
                }
                else if (player.HeroClassDefinition.HeroClass.ToString() == "WitchDoctor")
                {
                    if (Resbar == true)
                    {
                        CurRes = player.Stats.ResourceCurMana / player.Stats.ResourceMaxMana;
                        BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight);
                        ManaBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight);
                    }
                    if (player.HeroIsMale)
                    {
                        HeroTexture = Hud.Texture.GetTexture(3925954876);
                    }
                    else
                    {
                        HeroTexture = Hud.Texture.GetTexture(1603231623);
                    }
                }
                else if (player.HeroClassDefinition.HeroClass.ToString() == "Wizard")
                {
                    if (Resbar == true)
                    {
                        CurRes = player.Stats.ResourceCurArcane / player.Stats.ResourceMaxArcane;
                        BackgroundBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth, ResbarHeight);
                        ArcaneBrush.DrawRectangle(PlayerX - (float)ResbarWidth / 2, PlayerY - (float)(ScreenHeight / 28) / 1.6f, ResbarWidth * CurRes, ResbarHeight);
                    }
                    if (player.HeroIsMale)
                    {
                        HeroTexture = Hud.Texture.GetTexture(44435619);
                    }
                    else
                    {
                        HeroTexture = Hud.Texture.GetTexture(876580014);
                    }
                }

                if (Tag == true)
                {
                    string battleTag = player.BattleTagAbovePortrait;
                    if (battleTag == null)
                    {
                        continue;
                    }
                    TagDecorator.TextFunc = () => battleTag.ToString();
                    var BattleTagTexture = Hud.Texture.GetTexture(3098562643);
                    BattleTagTexture.Draw(PlayerX - (float)(ScreenWidth / 10) / 2, PlayerY - (float)(ScreenHeight / 7.8f) / 2, (float)(ScreenWidth / 10), (float)(ScreenHeight / 28), 0.7843f);
                    HeroTexture.Draw(PlayerX - (float)(Hud.Window.Size.Height / 31) / 2, PlayerY - (float)(ScreenHeight / 6.1f) / 2, (float)(ScreenHeight / 31), (float)(Hud.Window.Size.Height / 31), 1f);
                    TagDecorator.Paint(PlayerX - (float)(ScreenWidth / 11.5) / 2, PlayerY - (float)(ScreenHeight / 9.23f) / 2, (float)(ScreenWidth / 11.5), (float)(ScreenHeight / 45), HorizontalAlign.Center);
                }
            }
        }
Exemplo n.º 13
0
        public void PaintWorld(WorldLayer layer)
        {
            var monsters = Hud.Game.AliveMonsters;
            Dictionary <IMonster, string> eliteGroup = new Dictionary <IMonster, string>();

            foreach (var monster in monsters)
            {
                if (monster.Rarity == ActorRarity.Champion || monster.Rarity == ActorRarity.Rare)
                {
                    eliteGroup.Add(monster, String.Join(", ", monster.AffixSnoList));
                }
            }
            Dictionary <IMonster, string> eliteGroup1 = eliteGroup.OrderBy(p => p.Value).ToDictionary(p => p.Key, o => o.Value);

            var    px     = Hud.Window.Size.Width * 0.00125f;
            var    py     = Hud.Window.Size.Height * 0.001667f;
            var    h      = py * 5;
            var    w2     = py * 50;
            var    count  = 0;
            string preStr = null;

            //remove clone
            foreach (var elite in eliteGroup1)
            {
                bool illusionist = false;
                if (elite.Key.SummonerAcdDynamicId == 0)
                {
                    illusionist = false;
                }
                else
                {
                    illusionist = true;
                }
                if (elite.Key.Rarity == ActorRarity.Champion)
                {
                    if (illusionist == false)
                    {
                        var x      = Hud.Window.Size.Width * 0.125f;
                        var w      = elite.Key.CurHealth * w2 / elite.Key.MaxHealth;
                        var text   = (elite.Key.CurHealth * 100 / elite.Key.MaxHealth).ToString("f0") + "%";
                        var layout = TextFont.GetTextLayout(text);
                        if (preStr != elite.Value || preStr == null)
                        {
                            count++;
                        }
                        var y = py * 8 * count;
                        if (elite.Key.Invulnerable)
                        {
                            BorderBrush.DrawRectangle(x, y, w2, h);
                        }
                        BackgroundBrush.DrawRectangle(x, y, w2, h);
                        TextFont.DrawText(layout, x + px + w2, y - py);
                        ChampionBrush.DrawRectangle(x, y, (float)w, h);
                        preStr = elite.Value;
                        count++;
                    }
                }
                if (elite.Key.Rarity == ActorRarity.Rare)
                {
                    if (illusionist == false)
                    {
                        var x      = Hud.Window.Size.Width * 0.125f;
                        var w      = elite.Key.CurHealth * w2 / elite.Key.MaxHealth;
                        var text   = (elite.Key.CurHealth * 100 / elite.Key.MaxHealth).ToString("f0") + "%";
                        var layout = TextFont.GetTextLayout(text);
                        if (preStr != elite.Value || preStr == null)
                        {
                            count++;
                        }
                        var y = py * 8 * count;
                        if (elite.Key.Invulnerable)
                        {
                            BorderBrush.DrawRectangle(x, y, w2, h);
                        }
                        BackgroundBrush.DrawRectangle(x, y, w2, h);
                        TextFont.DrawText(layout, x + px + w2, y - py);
                        RareBrush.DrawRectangle(x, y, (float)w, h);
                        preStr = elite.Value;
                        count++;
                    }
                }
            }
            eliteGroup.Clear();
        }
Exemplo n.º 14
0
        public void PaintWorld(WorldLayer layer)
        {
            if (Hud.Game.IsInTown)
            {
                return;
            }

            var             h             = 17;
            var             w1            = 35;
            var             py            = Hud.Window.Size.Height / 600;
            var             monsters      = Hud.Game.AliveMonsters.Where(x => x.IsAlive);
            List <IMonster> monstersElite = new List <IMonster>();

            foreach (var monster in monsters)
            {
                if (monster.SummonerAcdDynamicId == 0)
                {
                    if (monster.Rarity == ActorRarity.RareMinion)
                    {
                        if (IlluSpawners.Contains(monster.SnoMonster.NameEnglish))
                        {
                            foreach (var snoMonsterAffix in monster.AffixSnoList)
                            {
                                if (snoMonsterAffix.Affix == MonsterAffix.Illusionist)
                                {
                                    monstersElite.Add(monster);
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            foreach (var monster in monstersElite)
            {
                var wint   = monster.CurHealth / monster.MaxHealth;
                var hptext = "";
                if ((wint < 0) || (wint > 1))
                {
                    wint = 1; hptext = "bug";
                }
                else
                {
                    hptext = ValueToString(wint * 100, ValueFormat.NormalNumberNoDecimal);
                }
                var w        = wint * w1;
                var layout   = TextFont.GetTextLayout(hptext);
                var monsterX = monster.FloorCoordinate.ToScreenCoordinate().X - w1 / 2;
                var monsterY = monster.FloorCoordinate.ToScreenCoordinate().Y - py * 8;
                if (monsterY < 0)
                {
                    monsterY = monster.FloorCoordinate.ToScreenCoordinate().Y;
                }
                monsterY -= 15.0f;
                var ShieldingX = monsterX - w1 / 2;
                var hauntX     = monsterX + w1 + 5;
                var buffY      = monsterY - 1;
                var hpX        = monsterX + 7;

                BorderBrush.DrawRectangle(monsterX, monsterY, w1, h);
                BackgroundBrush.DrawRectangle(monsterX, monsterY, w1, h);

                RareBrush.DrawRectangle(monsterX, monsterY, (float)w, h);
                TextFont.DrawText(layout, hpX, buffY);
            }
        }
        public void PaintTopInGame(ClipState clipState)
        //public void PaintWorld(WorldLayer layer)
        {
            if (!ShowTracker)
            {
                return;
            }

            var h = Hud.Window.Size.Height * 0.001667f * BarHeight;          //8
            var w = Hud.Window.Size.Width * 0.00155f * BarWidth;             //55

            if (PositionX == -1 || PositionY == -1)
            {
                var objectivesPosition = Hud.Render.GetUiElement("Root.NormalLayer.eventtext_bkgrnd.eventtext_region.title").Rectangle;
                PositionX = objectivesPosition.X - ProcRuleCalculator.StandardIconSize - Gap; // Hud.Render.MinimapUiElement.Rectangle.X - Gap*2 - w - Gap - ProcRuleCalculator.StandardIconSize; //left of the minimap
                PositionY = objectivesPosition.Y;                                             //Hud.Window.Size.Height * 0.015f; //0.14f;
            }

            var x = PositionX;
            var y = PositionY;

            IEnumerable <KeyValuePair <uint, ProcInfo> > ActiveSnapshots = Snapshots.Where(kvp => kvp.Value.FinishTick > Hud.Game.CurrentGameTick);

            //draw background
            int active = ActiveSnapshots.Count();

            if (active > 0)
            {
                ShadowBrush.Opacity = 0.25f;
                ShadowBrush.DrawRectangle(x + ProcRuleCalculator.StandardIconSize, y, w + Gap * 2 + BorderBrush.StrokeWidth, active * (ProcRuleCalculator.StandardIconSize + Gap) - Gap);
            }

            //draw countdowns
            foreach (KeyValuePair <uint, ProcInfo> entry in ActiveSnapshots)
            {
                //render the proc snapshot if it is not expired
                ProcInfo snapshot = entry.Value;
                float    timeLeft = (float)(snapshot.FinishTick - Hud.Game.CurrentGameTick) / 60f;              //seconds
                float    w2       = (float)(timeLeft * w / snapshot.Duration);
                float    opacity  = (timeLeft >= 1 || (timeLeft < 1 && (Hud.Game.CurrentRealTimeMilliseconds / 200) % 2 == 0) ? 0.9f : 0.2f);

                snapshot.Texture.Draw(x, y, ProcRuleCalculator.StandardIconSize, ProcRuleCalculator.StandardIconSize, opacity);                 //draw custom icon
                BorderBrush.DrawRectangle(x + 1, y + 1, ProcRuleCalculator.StandardIconSize - 2, ProcRuleCalculator.StandardIconSize - 2);      //draw custom border

                float x2 = x + ProcRuleCalculator.StandardIconSize + Gap + BorderBrush.StrokeWidth;
                float y2 = y + ProcRuleCalculator.StandardIconSize * 0.5f - h * 0.5f;

                ShadowBrush.Opacity = 0.25f;
                ShadowBrush.DrawRectangle(x2 - 4, y2 - 4, w + 8, h + 8);

                IBrush brush;
                if (!ProcBrush.TryGetValue(snapshot.PlayerClass, out brush))
                {
                    brush = ProcBrushDefault;
                }

                brush.DrawRectangle(x2, y2, w2, h);
                BorderBrush.DrawRectangle(x2 - 2, y2 - 2, w + 4, h + 4);

                //draw countdown text
                TextLayout layout = TimeLeftFont.GetTextLayout(timeLeft.ToString(timeLeft > 1 ? "F0" : "F1"));
                TimeLeftFont.DrawText(layout, x2 + w * 0.5f - layout.Metrics.Width * 0.5f, y2 + h * 0.5f - layout.Metrics.Height * 0.5f);

                //draw player name
                layout = PlayerFont.GetTextLayout(snapshot.PlayerName);
                PlayerFont.DrawText(layout, x - layout.Metrics.Width - Gap, y + ProcRuleCalculator.StandardIconSize * 0.5f - layout.Metrics.Height * 0.5f);

                y += ProcRuleCalculator.StandardIconSize + Gap;
            }             //end foreach
        } //end PaintTopInGame