Exemplo n.º 1
0
        private void DebugTimedAdd()
        {
            if (!_debugStarted)
            {
                _debugLabels = new List <Label>();
                foreach (Label l in Labels)
                {
                    _debugLabels.Add(l);
                }
                Labels.Clear();
                _debugStarted = true;
            }

            int time = (int)debugWatch.ElapsedMilliseconds / 1000;

            if (time != _debugAddShifter)
            {
                _debugAlreadyAdded = false;
            }
            if (time % 2 == 0 && !_debugAlreadyAdded)
            {
                _debugAlreadyAdded = true;
                _debugAddShifter   = time;
                var layout1 = TextFont.GetTextLayout("" + time);
                TextFont.DrawText(layout1, hudWidth * 0.2f - (layout1.Metrics.Width * 0.5f), hudHeight * .15f);

                Labels.Add(_debugLabels[0]);
                _debugLabels.RemoveAt(0);
            }
            if (_debugLabels.Count == 0)
            {
                _debugDone = true;
            }
        }
Exemplo n.º 2
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (clipState != ClipState.AfterClip)
            {
                return;
            }
            //if (!Visible) return;
            if (!Hud.Input.IsKeyDown(Keys.V))
            {
                return;
            }

            var s = Hud.Window.Size;

            var text = string.Format(CultureInfo.InvariantCulture, "{0}x{1}\nX: {2,4}\nY: {3,4}",
                                     s.Width, s.Height,
                                     string.Format(CultureInfo.InvariantCulture, "{0} px | % : {1}f", Hud.Window.CursorX, Hud.Window.CursorX / (float)s.Width),
                                     string.Format(CultureInfo.InvariantCulture, "{0} px | % : {1}f", Hud.Window.CursorY, Hud.Window.CursorY / (float)s.Height)
                                     );

            var layout = TextFont.GetTextLayout(text);
            var h      = layout.Metrics.Height;
            var w      = layout.Metrics.Width;

            var offsetX = Hud.Window.CursorX + (int)(s.Width / 2 > Hud.Window.CursorX ? Offset : -w - Offset);
            var offsetY = Hud.Window.CursorY + (int)(s.Height / 2 > Hud.Window.CursorY ? Offset : -h - Offset);

            BackgroundBrush.DrawRectangle(offsetX - Padding, offsetY - Padding, w + Padding * 2, h + Padding * 2);
            TextFont.DrawText(layout, offsetX, offsetY);
        }
Exemplo n.º 3
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (clipState != ClipState.BeforeClip)
            {
                return;
            }
            var textDistanceAway = TextDistanceAway;

            var monsters = Hud.Game.AliveMonsters.Where(monster => MonsterBrushes.ContainsKey(monster.Rarity) && monster.SummonerAcdDynamicId == 0 && monster.NormalizedXyDistanceToMe > CloseEnoughRange);

            foreach (var monster in monsters)
            {
                var monsterScreenCoordinate = monster.FloorCoordinate.ToScreenCoordinate();

                //Draw line to monster
                var start = PointOnLine(center.X, center.Y, monsterScreenCoordinate.X, monsterScreenCoordinate.Y, 60);
                var end   = PointOnLine(monsterScreenCoordinate.X, monsterScreenCoordinate.Y - 30, center.X, center.Y, 20);

                if (!monster.IsOnScreen)
                {
                    MonsterBrushes[monster.Rarity].DrawLine(start.X, start.Y, end.X, end.Y, StrokeWidth);
                    if (ShowText) //Draw text
                    {
                        var layout = TextFont.GetTextLayout(string.Format("{0:N0}", monster.NormalizedXyDistanceToMe) + "码");
                        var p      = PointOnLine(center.X, center.Y, monsterScreenCoordinate.X, monsterScreenCoordinate.Y, textDistanceAway);
                        TextFont.DrawText(layout, p.X, p.Y);
                        textDistanceAway += 30; // avoid text overlap
                    }
                }
            }
        }
Exemplo n.º 4
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (clipState != ClipState.BeforeClip)
            {
                return;
            }
            if (!Hud.Game.Me.Powers.BuffIsActive(Hud.Sno.SnoPowers.AncientParthanDefenders.Sno))
            {
                return;
            }
            int Count = Hud.Game.AliveMonsters.Count(m => (m.Stunned || m.Frozen) && m.NormalizedXyDistanceToMe <= 25);

            if (Count == 0)
            {
                return;
            }
            double dr   = 100 * (1 - Math.Pow(1 - percent * 0.01d, Count));
            float  XPos = Hud.Window.Size.Width * XWidth;
            float  YPos = Hud.Window.Size.Height * YHeight;

            if (Hud.Game.Me.CubeSnoItem2.LegendaryPower.Sno == Hud.Sno.SnoPowers.AncientParthanDefenders.Sno)
            {
                percent = 12;
            }
            textBuilder.Clear();
            textBuilder.AppendFormat("古帕触发数: {0} 特效值:{1}%", Count, percent);
            textBuilder.AppendLine();
            textBuilder.AppendFormat("古帕总减伤: {0}", dr.ToString("f2") + "%");

            var layout = TextFont.GetTextLayout(textBuilder.ToString());

            TextFont.DrawText(layout, XPos, YPos);
        }
 private void DrawColumnHeaders(float x, float y, float columnHeaderWidth)//, List<IItem> items)
 {
     foreach (var location in ItemLocations)
     {
         //var item = items.FirstOrDefault(i => i.Location == location);
         var columnHeaderLayout = TextFont.GetTextLayout(location.ToString());
         TextFont.DrawText(columnHeaderLayout, x + (columnHeaderWidth / 2) - (columnHeaderLayout.Metrics.Width / 2), y - columnHeaderLayout.Metrics.Height);
         x += columnHeaderWidth;
     }
 }
Exemplo n.º 6
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (clipState != ClipState.BeforeClip)
            {
                return;
            }
            if (Debug && !_started)
            {
                DebugAnimations();
            }

            if (AnimationsEnabled)
            {
                AnimationUpdate();
            }

            //Monster lines
            if (MonsterLinesEnabled)
            {
                var textDistanceAway = TextDistanceAway;
                var monsters         = Hud.Game.AliveMonsters.Where(monster => MonsterBrushes.ContainsKey(monster.Rarity) && monster.NormalizedXyDistanceToMe > CloseEnoughRange && monster.SummonerAcdDynamicId == 0);
                foreach (var monster in monsters)
                {
                    var monsterScreenCoordinate = monster.FloorCoordinate.ToScreenCoordinate();
                    DrawLine(monsterScreenCoordinate, MonsterBrushes[monster.Rarity], !(monster.NormalizedXyDistanceToMe < HitRange));

                    if (!MonsterDistanceTextEnabled)
                    {
                        continue;
                    }
                    var layout = TextFont.GetTextLayout(string.Format("{0:N0}", monster.NormalizedXyDistanceToMe));
                    var p      = PointOnLine(Center.X, Center.Y, monsterScreenCoordinate.X, monsterScreenCoordinate.Y, textDistanceAway);
                    TextFont.DrawText(layout, p.X, p.Y);
                    textDistanceAway += 30; // avoid text overlap
                }
            }

            //Gizmo lines
            if ((!GizmoLinesEnabled || Hud.Game.IsInTown) && !Debug)
            {
                return;
            }
            var gizmos = Hud.Game.Actors.Where(actor => GizmoBrushes.ContainsKey(actor.GizmoType));

            foreach (var gizmo in gizmos)
            {
                if (gizmo.IsOperated)
                {
                    continue;
                }
                var gizmoPos  = gizmo.FloorCoordinate.ToScreenCoordinate();
                var gizmoLine = GizmoBrushes[gizmo.GizmoType];
                DrawLine(gizmoPos, gizmoLine, false);
            }
        }
Exemplo n.º 7
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));
        }
        private void DrawHeaderLine(float x, float y, float columnHeaderWidth, IEnumerable <IItem> items)
        {
            var width = columnHeaderWidth;
            var rect  = new RectangleF(x - width, y, width, width * 2);

            foreach (var location in ItemLocations)
            {
                var item = items.FirstOrDefault(i => i.Location == location);
                if (item != null)
                {
                    var bgTex = Hud.Texture.GetItemBackgroundTexture(item);

                    if (bgTex.Width == bgTex.Height)
                    {
                        rect.Y      = y + width;
                        rect.Height = width;
                        BackgroundBrush.DrawRectangle(rect);
                    }
                    else
                    {
                        rect.Y      = y;
                        rect.Height = width * 2;
                    }

                    ItemRenderer.RenderItem(item, rect);
                    var ancientRank = item.AncientRank;
                    if (ancientRank >= 1)
                    {
                        var ancientRankText = ancientRank == 1 ? "A" : "P";
                        var font            = ancientRank == 1 ? AncientRankFont : PrimalRankFont;

                        var textRank   = ancientRankText + (item.CaldesannRank > 0 ? ("+" + item.CaldesannRank.ToString("D", CultureInfo.InvariantCulture)) : "");
                        var textLayout = font.GetTextLayout(textRank);
                        font.DrawText(textLayout, rect.Right - textLayout.Metrics.Width - 4, rect.Bottom - textLayout.Metrics.Height - 2);
                    }

                    var text       = string.Format("{0:0.#} %", item.Perfection);
                    var layout     = TextFont.GetTextLayout(text);
                    var brushIndex = (int)Math.Round(item.Perfection / 100 * (float)(gradientBrushes.Count - 1));
                    if (brushIndex >= 0 && brushIndex < gradientBrushes.Count)
                    {
                        gradientBrushes[brushIndex].DrawRectangle(rect.X, rect.Y - layout.Metrics.Height, columnHeaderWidth, layout.Metrics.Height);
                    }

                    TextFont.DrawText(layout, rect.X + columnHeaderWidth / 2 - layout.Metrics.Width / 2, rect.Y - layout.Metrics.Height);
                }

                rect.X -= width + 1;
            }
        }
Exemplo n.º 9
0
        /// <summary>
        ///     Fired when the game is drawn.
        /// </summary>
        /// <param name="args">The <see cref="EventArgs" /> instance containing the event data.</param>
        private static void Drawing_OnDraw(EventArgs args)
        {
            if (Menu.Item("DrawRange").IsActive())
            {
                Render.Circle.DrawCircle(ObjectManager.Player.Position,
                                         Menu.Item("CalculateRange").GetValue <Slider>().Value, Color.CadetBlue);
            }

            if (Status == CalcStatus.NoEnemies || !DrawCalculation)
            {
                return;
            }

            // Draw box
            BoxLine.Width = Height;
            BoxLine.Begin();
            BoxLine.Draw(new[] { Position, Position + new Vector2(Width, 0) }, new ColorBGRA(0, 0, 0, 256 / 2));
            BoxLine.End();

            // Draw text
            TextFont.DrawText(
                null,
                string.Format("Ally Damage: {0}", (int)allyDamage),
                (int)RealBoxPosition.X + 10,
                (int)RealBoxPosition.Y + 5,
                new ColorBGRA(0, 255, 0, 255));

            TextFont.DrawText(
                null,
                string.Format("Ally Health: {0}", (int)allyHealth),
                (int)(RealBoxPosition.X + 10),
                (int)RealBoxPosition.Y + 5 + TextHeightSpacing,
                new ColorBGRA(0, 255, 0, 255));

            TextFont.DrawText(
                null,
                string.Format("Enemy Damage: {0}", (int)enemyDamage),
                (int)(RealBoxPosition.X + 10),
                (int)RealBoxPosition.Y + 5 + TextHeightSpacing * 2,
                new ColorBGRA(255, 0, 0, 255));

            TextFont.DrawText(
                null,
                string.Format("Enemy Health: {0}", (int)enemyHealth),
                (int)(RealBoxPosition.X + 10),
                (int)RealBoxPosition.Y + 5 + TextHeightSpacing * 3,
                new ColorBGRA(255, 0, 0, 255));
        }
        private float DrawStatLine(string attributeCode, float x, float y, float _columnHeaderWidth)
        {
            var rowHeaderLayout = TextFont.GetTextLayout(attributeCode);
            var _x = x;

            foreach (var location in ItemLocations)
            {
                var item  = items.FirstOrDefault(i => i.Location == location);
                var brush = BackgroundBrush;
                _x -= _columnHeaderWidth + 1;

                if (item == null)
                {
                    continue;
                }
                var perfection = item.Perfections.FirstOrDefault(p => p.Attribute.Code == attributeCode);

                if (perfection != null)
                {
                    var stringFormat = perfection.Attribute.Code.Contains("Percent") ? "{0:0.#} %" : "{0:0.#}";
                    var text         = string.Format(stringFormat, perfection.Cur >= 1 ? perfection.Cur : (perfection.Cur * 100), perfection.Min, perfection.Max, perfection.Percent());
                    var layout       = TextFont.GetTextLayout(text);

                    var brushIndex = (int)Math.Round(perfection.Percent() * (float)(gradientBrushes.Count - 1));
                    if (brushIndex >= 0 && brushIndex < gradientBrushes.Count)
                    {
                        brush = gradientBrushes[brushIndex];
                        brush.DrawRectangle(_x, y, _columnHeaderWidth, rowHeaderLayout.Metrics.Height);
                    }

                    TextFont.DrawText(layout, _x + (_columnHeaderWidth / 2) - (layout.Metrics.Width / 2), y);
                }
                else
                {
                    brush.DrawRectangle(_x, y, _columnHeaderWidth, rowHeaderLayout.Metrics.Height);
                }
            }

            TextFont.DrawText(rowHeaderLayout, _x - rowHeaderLayout.Metrics.Width - 2, y);

            return(rowHeaderLayout.Metrics.Height + 1);
        }
        public void Paint(IActor actor, IWorldCoordinate coord, string text)
        {
            if (!Enabled)
            {
                return;
            }
            if (ActiveBrush == null || InactiveBrush == null)
            {
                return;
            }

            var distance = actor.NormalizedXyDistanceToMe;

            if (distance <= HideRange)
            {
                return;
            }

            var monsterCoord = coord.ToScreenCoordinate();
            var myCoords     = Hud.Game.Me.ScreenCoordinate;

            //Draw line to actor
            var start = PointOnLine(myCoords.X, myCoords.Y, monsterCoord.X, monsterCoord.Y, OnLineStartOffset);
            var end   = PointOnLine(monsterCoord.X, monsterCoord.Y, myCoords.X, myCoords.Y, OnLineEndOffset);

            if (distance < ActiveRange)
            {
                ActiveBrush.DrawLine(start.X, start.Y, end.X, end.Y, ActiveStrokeWidth);
            }
            else
            {
                InactiveBrush.DrawLine(start.X, start.Y, end.X, end.Y, InactiveStrokeWidth);
            }

            if (ShowText) //Draw text
            {
                var layout = TextFont.GetTextLayout(string.Format("{0:N0}", distance));
                var p      = PointOnLine(myCoords.X, myCoords.Y, monsterCoord.X, monsterCoord.Y, TextOffset);
                TextFont.DrawText(layout, p.X, p.Y);
                //textDistanceAway += 30; // avoid text overlap
            }
        }
Exemplo n.º 12
0
        public void Paint(float x, float y, float w, float h, string text, HorizontalAlign align)
        {
            if (TextFont == null)
            {
                return;
            }

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

            if (!string.IsNullOrEmpty(text))
            {
                var layout     = TextFont.GetTextLayout(text);
                var layoutChar = TextFont.GetTextLayout(":");
                switch (align)
                {
                case HorizontalAlign.Left:
                    TextFont.DrawText(layout, x + layoutChar.Metrics.Width, 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 - layoutChar.Metrics.Width, y + (h - layout.Metrics.Height) / 2);
                    break;
                }
            }

            if (BorderBrush != null)
            {
                //BorderBrush.DrawRectangle(x, y, w, h);
                BorderBrush.DrawRectangleGridFit(x, y, w, h);
            }
        }
Exemplo n.º 13
0
        public void Paint(ISnoPower power, float x, float y, int textLenght = 25)
        {
            var name  = string.Empty;
            var items = power.GetItemSnos();

            if (items.Any(xx => xx != 0) && string.IsNullOrWhiteSpace(power.NameEnglish))
            {
                //name = Hud.Inventory.GetSnoItem(items.First()).NameEnglish;
                var item = Hud.Inventory.GetSnoItem(items.First());
                name = item == null?power.Sno.ToString() : item.NameEnglish;
            }
            else
            {
                name = string.IsNullOrWhiteSpace(power.NameEnglish) ? power.Sno.ToString() : power.NameEnglish;
            }

            if (name.Length > textLenght)
            {
                name = name.Substring(0, textLenght);
            }

            var layout       = TextFont.GetTextLayout(string.Format("{0,25} Ic:", name));
            var layoutSpacer = TextFont.GetTextLayout(":");

            TextFont.DrawText(layout, x, y);

            if (Hud.Window.CursorInsideRect(x, y, layout.Metrics.Width, layout.Metrics.Height))
            {
                Hud.Render.SetHint(power.Sno + " : " + power.Code + " : " + power.DescriptionEnglish);
            }

            x += layout.Metrics.Width + layoutSpacer.Metrics.Width * 2;

            if (power.NormalIconTextureId != 0)
            {
                var texture = Hud.Texture.GetTexture(power.NormalIconTextureId);

                if (texture != null)
                {
                    texture.Draw(x, y, StandardIconSize, StandardIconSize);
                }
                else
                {
                    BackgroundBrush.DrawRectangle(x, y, StandardIconSize, StandardIconSize);
                }

                if (Hud.Window.CursorInsideRect(x, y, StandardIconSize, StandardIconSize))
                {
                    Hud.Render.SetHint("TextureId : " + power.NormalIconTextureId);
                }
                x += StandardIconSize + StandardIconSpacing;
            }

            foreach (var icon in power.Icons.Where(xxx => xxx.Exists && xxx.TextureId != 0 && xxx.TextureId != power.NormalIconTextureId).Select(xxx => xxx.TextureId).Distinct())
            {
                var texture = Hud.Texture.GetTexture(icon);

                if (texture != null)
                {
                    texture.Draw(x, y, StandardIconSize, StandardIconSize);
                }
                else
                {
                    BackgroundBrush.DrawRectangle(x, y, StandardIconSize, StandardIconSize);
                }

                if (Hud.Window.CursorInsideRect(x, y, StandardIconSize, StandardIconSize))
                {
                    Hud.Render.SetHint("TextureId : " + icon);
                }

                x += StandardIconSize + StandardIconSpacing;
            }

            layout = TextFont.GetTextLayout(" It:");
            TextFont.DrawText(layout, x, y);
            x += layout.Metrics.Width + layoutSpacer.Metrics.Width;

            foreach (var sno in items)
            {
                if (sno == 0)
                {
                    continue;
                }

                var item = Hud.Inventory.GetSnoItem(sno);
                if (item == null)
                {
                    continue;
                }

                var brush = item.SetItemBonusesSno == uint.MaxValue
                    ? LegendaryBackgroundBrush
                    : SetBackgroundBrush;

                brush.DrawRectangle(x, y, StandardIconSize, StandardIconSize);

                var texture = Hud.Texture.GetItemTexture(item);

                if (texture != null)
                {
                    texture.Draw(x, y, StandardIconSize, StandardIconSize);
                }
                else
                {
                    BackgroundBrush.DrawRectangle(x, y, StandardIconSize, StandardIconSize);
                }

                if (Hud.Window.CursorInsideRect(x, y, StandardIconSize, StandardIconSize))
                {
                    Hud.Render.SetHint(item.NameEnglish + " : " + item.Sno + " : i" + item.Level + " : " + item.SetItemBonusesSno);
                }

                x += StandardIconSize + StandardIconSpacing;
            }
        }
Exemplo n.º 14
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);
                    }
                }
            }
        }
Exemplo n.º 15
0
        public void PaintWorld(WorldLayer layer)
        {
            var  hedPlugin = Hud.GetPlugin <HotEnablerDisablerPlugin>();
            bool GoOn      = hedPlugin.CanIRun(Hud.Game.Me, this.GetType().Name);

            if (!GoOn)
            {
                return;
            }

            bool ZeiActive = false;

            ZeiRank = 0;
            var jewelsLocations = Hud.Game.Items.Where(x => x.Location == ItemLocation.LeftRing || x.Location == ItemLocation.RightRing || x.Location == ItemLocation.Neck);

            foreach (var ZeiLocation in jewelsLocations)
            {
                if (ZeiLocation.SocketCount != 1 || ZeiLocation.ItemsInSocket == null)
                {
                    continue;
                }
                var Zei = ZeiLocation.ItemsInSocket.FirstOrDefault();
                if (Zei == null)
                {
                    continue;
                }
                if (Zei.SnoItem.Sno == 3249733225)
                {
                    ZeiActive = true; ZeiRank = Zei.JewelRank; break;
                }
                else
                {
                    continue;
                }
            }


            if (ZeiActive == false)
            {
                return;
            }
            if (permanentCircle)
            {
                if (Hud.Game.IsInTown)
                {
                    return;
                }
            }
            else
            {
                if (!Hud.Game.Me.InCombat)
                {
                    goto MiniMapCircle;
                }
            }


            OutlineBrush.DrawWorldEllipse(50, -1, Hud.Game.Me.FloorCoordinate);

            var Smonster = Hud.Game.SelectedMonster2 ?? Hud.Game.SelectedMonster1;

            if ((Smonster == null))
            {
                return;
            }

            var monsters = Hud.Game.AliveMonsters.Where(monster => monster.Attackable && monster == Smonster);

            foreach (var monster in monsters)
            {
                if (ElitesOnlyNumbers && !monster.IsElite)
                {
                    continue;
                }
                var monsterScreenCoordinate = monster.FloorCoordinate.ToScreenCoordinate();
                percentDamageBonus = "";
                float gemMaths = 4f + (0.08f * (float)ZeiRank);

                if (monster.NormalizedXyDistanceToMe < 50)
                {
                    percentDamageBonus = "+" + (gemMaths * ((float)monster.NormalizedXyDistanceToMe / 10)).ToString("0.00") + "%";
                }
                else
                {
                    percentDamageBonus = "+" + (gemMaths * 5f).ToString("0.00") + "% Max!";
                }

                float visibleX;
                float visibleY;
                float MidX = (float)midX;
                float MidY = (float)midY;

                if (monsterScreenCoordinate.X > MidX)
                {
                    visibleX = monsterScreenCoordinate.X - 60f;
                }
                else
                {
                    visibleX = monsterScreenCoordinate.X + 50f;
                }
                if (monsterScreenCoordinate.Y > MidY)
                {
                    visibleY = monsterScreenCoordinate.Y - 150f;
                }
                else
                {
                    visibleY = monsterScreenCoordinate.Y + 50f;
                }

                var layout = TextFont.GetTextLayout(percentDamageBonus);
                TextFont.DrawText(layout, visibleX, visibleY);
            }

MiniMapCircle:
            if (Hud.Game.IsInTown)
            {
                return;
            }
            ZeiMiniMapDecorator.Paint(layer, null, Hud.Game.Me.FloorCoordinate, null);
            var cursorScreenCoord = Hud.Window.CreateScreenCoordinate(Hud.Window.CursorX, Hud.Window.CursorY);
            var visorWorldCoord   = cursorScreenCoord.ToWorldCoordinate();

            MiniMapVisorDecorator.Paint(layer, null, visorWorldCoord, null);
        }
        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.º 17
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.º 18
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (clipState != ClipState.BeforeClip)
            {
                return;
            }
            var inRift = Hud.Game.SpecialArea == SpecialArea.Rift || Hud.Game.SpecialArea == SpecialArea.GreaterRift;

            if (TextFont == null)
            {
                return;
            }

            double totalMonsterRiftProgression = 0;
            double TrashMonsterRiftProgression = 0;
            double EliteProgression            = 0;
            double RiftGlobeProgression        = 0;
            int    monstersCount  = 0;
            int    EliteCount     = 0;
            int    ElitePackCount = 0;
            // locust
            int locustCount      = 0;
            int ElitelocustCount = 0;
            // haunted
            int hauntedCount      = 0;
            int ElitehauntedCount = 0;
            //Palmed
            int palmedCount      = 0;
            int ElitepalmedCount = 0;
            //Phoenixed BUG? http://turbohud.freeforums.net/thread/3945/monster-phoenixed
            int phoenixedCount      = 0;
            int ElitephoenixedCount = 0;
            //Strongarmed
            int   strongarmedCount      = 0;
            int   ElitestrongarmedCount = 0;
            float XPos = Hud.Window.Size.Width * XWidth;
            float YPos = Hud.Window.Size.Height * YHeight;

            var monsters = Hud.Game.AliveMonsters.Where(m => m.SummonerAcdDynamicId == 0 && m.IsElite || !m.IsElite);

            foreach (var monster in monsters)
            {
                var Elite = monster.Rarity == ActorRarity.Rare || monster.Rarity == ActorRarity.Champion;
                if (monster.FloorCoordinate.XYDistanceTo(Hud.Game.Me.FloorCoordinate) > yard)
                {
                    continue;
                }
                monstersCount++;
                if (inRift && ShowTotalProgression)
                {
                    if (monster.Rarity == ActorRarity.Rare)
                    {
                        EliteProgression += 4 * 1.15d;
                    }
                    if (!monster.IsElite)
                    {
                        TrashMonsterRiftProgression += monster.SnoMonster.RiftProgression * 100.0d / this.Hud.Game.MaxQuestProgress;
                    }
                    else
                    {
                        EliteProgression += monster.SnoMonster.RiftProgression * 100.0d / this.Hud.Game.MaxQuestProgress;
                    }
                }
                if (monster.Rarity == ActorRarity.Rare)
                {
                    EliteCount++;
                    ElitePackCount++;
                }
                if (monster.Rarity == ActorRarity.Champion)
                {
                    EliteCount++;
                }
                if (monster.Locust && ShowLlocustCount)
                {
                    locustCount++;
                    if (Elite)
                    {
                        ElitelocustCount++;
                    }
                }
                if (monster.Haunted && ShowHauntedCount)
                {
                    hauntedCount++;
                    if (Elite)
                    {
                        ElitehauntedCount++;
                    }
                }
                if (monster.Palmed && ShowPalmedCount)
                {
                    palmedCount++;
                    if (Elite)
                    {
                        ElitepalmedCount++;
                    }
                }
                if (monster.Phoenixed && ShowPhoenixedCount)
                {
                    phoenixedCount++;
                    if (Elite)
                    {
                        ElitephoenixedCount++;
                    }
                }
                if (monster.Strongarmed && ShowStrongarmedCount)
                {
                    strongarmedCount++;
                    if (Elite)
                    {
                        ElitestrongarmedCount++;
                    }
                }
            }
            var actors = Hud.Game.Actors.Where(x => x.SnoActor.Kind == ActorKind.RiftOrb);

            foreach (var actor in actors)
            {
                RiftGlobeProgression += 1.15d;
            }
            var packs = Hud.Game.MonsterPacks;

            if (packs.Any())
            {
                foreach (var pack in packs)
                {
                    if (!pack.MonstersAlive.Any())
                    {
                        continue;
                    }
                    if (pack.IsFullChampionPack)
                    {
                        EliteProgression += 3 * 1.15f;
                        ElitePackCount++;
                    }
                }
            }
            if (monstersCount == 0 && totalMonsterRiftProgression == 0)
            {
                return;
            }

            textBuilder.Clear();
            textBuilder.AppendFormat("{0} 码怪物总数: {1}", yard, monstersCount);
            textBuilder.AppendLine();
            if (EliteCount > 0)
            {
                textBuilder.AppendFormat("精英: {0} 只({1}组)", EliteCount, ElitePackCount);
            }
            textBuilder.AppendLine();
            textBuilder.AppendLine();

            if (inRift && ShowTotalProgression)
            {
                totalMonsterRiftProgression = TrashMonsterRiftProgression + EliteProgression + RiftGlobeProgression;
                textBuilder.AppendFormat("总进度: {0}%", totalMonsterRiftProgression.ToString("f2"));
                textBuilder.AppendLine();
                if (TrashMonsterRiftProgression > 0)
                {
                    textBuilder.AppendFormat("白怪进度: {0}%", TrashMonsterRiftProgression.ToString("f2"));
                    textBuilder.AppendLine();
                }
                if (EliteProgression > 0)
                {
                    textBuilder.AppendFormat("精英进度: {0}%", EliteProgression.ToString("f2"));
                    textBuilder.AppendLine();
                }
                if (RiftGlobeProgression > 0)
                {
                    textBuilder.AppendFormat("进度球进度: {0}%", RiftGlobeProgression.ToString("f2"));
                    textBuilder.AppendLine();
                }
                textBuilder.AppendLine();
            }
            if (locustCount > 0)
            {
                textBuilder.AppendFormat("虫群: {0}/{1}", locustCount, monstersCount);
                if (ElitelocustCount > 0)
                {
                    textBuilder.AppendFormat(" (精英: {0}/{1})", ElitelocustCount, EliteCount);
                }
                textBuilder.AppendLine();
            }
            if (hauntedCount > 0)
            {
                textBuilder.AppendFormat("蚀魂: {0}/{1}", hauntedCount, monstersCount);
                if (ElitehauntedCount > 0)
                {
                    textBuilder.AppendFormat(" (精英: {0}/{1})", ElitehauntedCount, EliteCount);
                }
                textBuilder.AppendLine();
            }
            if (palmedCount > 0)
            {
                textBuilder.AppendFormat("爆裂掌: {0}/{1}", palmedCount, monstersCount);
                if (ElitepalmedCount > 0)
                {
                    textBuilder.AppendFormat(" (精英: {0}/{1})", ElitepalmedCount, EliteCount);
                }
                textBuilder.AppendLine();
            }
            if (phoenixedCount > 0)
            {
                textBuilder.AppendFormat("火鸟: {0}/{1}", phoenixedCount, monstersCount);
                if (ElitephoenixedCount > 0)
                {
                    textBuilder.AppendFormat(" (精英: {0}/{1})", ElitephoenixedCount, EliteCount);
                }
                textBuilder.AppendLine();
            }
            if (strongarmedCount > 0)
            {
                textBuilder.AppendFormat("力士: {0}/{1}", strongarmedCount, monstersCount);
                if (ElitestrongarmedCount > 0)
                {
                    textBuilder.AppendFormat(" (精英: {0}/{1})", ElitestrongarmedCount, EliteCount);
                }
                textBuilder.AppendLine();
            }
            if (totalMonsterRiftProgression >= 100d - Hud.Game.RiftPercentage && Hud.Game.RiftPercentage != 100 || TrashMonsterRiftProgression >= 100d - Hud.Game.RiftPercentage && Hud.Game.RiftPercentage != 100)
            {
                if (totalMonsterRiftProgression >= 100d - Hud.Game.RiftPercentage && Hud.Game.RiftPercentage != 100)
                {
                    TextFont = Hud.Render.CreateFont("tahoma", 9, 255, 255, 128, 0, false, false, true);
                }
                if (TrashMonsterRiftProgression >= 100d - Hud.Game.RiftPercentage && Hud.Game.RiftPercentage != 100)
                {
                    TextFont = Hud.Render.CreateFont("tahoma", 9, 255, 255, 0, 0, false, false, true);
                }
            }
            else
            {
                TextFont = Hud.Render.CreateFont("tahoma", 9, 255, 180, 147, 109, false, false, true);
            }

            var layout = TextFont.GetTextLayout(textBuilder.ToString());

            TextFont.DrawText(layout, XPos, YPos);
        }
Exemplo n.º 19
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();
        }
        public void PaintTopInGame(ClipState clipState)
        {
            if (clipState != ClipState.AfterClip)
            {
                return;
            }
            if (!uiInventory.Visible)
            {
                return;
            }

            //GreyBrush.DrawRectangle(0, 0, Hud.Window.Size.Width, Hud.Window.Size.Height);

            if (items == null)
            {
                items = Hud.Game.Items.Where(i => i.Location >= ItemLocation.Head && i.Location <= ItemLocation.Neck);
            }

            // TODO : there is probably a better way to cache this, but i'm not able to detect stats reroll with enchantress
            attributes = items.SelectMany(i => i.Perfections).Select(p => p.Attribute.Code).Distinct();

            var topOffset          = 30f;
            var yOffset            = 15f;
            var _columnHeaderWidth = columnHeaderWidth();
            var x = uiInventory.Rectangle.Left;
            var y = topOffset + _columnHeaderWidth * 2;

            foreach (var item in items)
            {
                var rect = Hud.Inventory.GetItemRect(item);
                if (rect == RectangleF.Empty)
                {
                    continue;
                }

                var text       = string.Format("{0:0.#} %", item.Perfection);
                var layout     = TextFont.GetTextLayout(text);
                var brushIndex = (int)Math.Round(item.Perfection / 100 * (float)(gradientBrushes.Count - 1));
                if (brushIndex >= 0 && brushIndex < gradientBrushes.Count)
                {
                    gradientBrushes[brushIndex].DrawRectangle(rect.X, rect.Y - layout.Metrics.Height, _columnHeaderWidth, layout.Metrics.Height);
                }

                TextFont.DrawText(layout, rect.X + _columnHeaderWidth / 2 - layout.Metrics.Width / 2, rect.Y - layout.Metrics.Height);
            }

            //DrawHeaderLine(x, topOffset, _columnHeaderWidth, items);

            //y += DrawStatBlock(primaryDamageAttributes, y, x, _columnHeaderWidth);
            //y += yOffset;
            //y += DrawStatBlock(ehpAttributes, y, x, _columnHeaderWidth);
            //y += yOffset;
            //y += DrawStatBlock(secondaryAttributes, y, x, _columnHeaderWidth);
            //y += yOffset;
            //y += DrawStatBlock(powersAttributes, y, x, _columnHeaderWidth);
            //y += yOffset;

            //// TODO : remove this, only useful while debugging to find missing stats
            //foreach (var attributeCode in attributes)
            //{
            //    if (primaryDamageAttributes.Contains(attributeCode)) continue;
            //    if (ehpAttributes.Contains(attributeCode)) continue;
            //    if (secondaryAttributes.Contains(attributeCode)) continue;
            //    if (powersAttributes.Contains(attributeCode)) continue;

            //    y += DrawStatLine(attributeCode, x, y, _columnHeaderWidth);
            //}
        }
Exemplo n.º 21
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);
            }
        }
Exemplo n.º 22
0
        public override 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 * 6;

            var w2 = py * 80;

            var count = 0;

            string preStr = null;

            //remove clone

            foreach (var elite in eliteGroup1)

            {
                if (elite.Key.Rarity == ActorRarity.Champion)

                {
                    var eliteCurMaxHealth = 0.0d;

                    var eliteMaxHealth = 0.0d;

                    bool illusionist = false;

                    int same = 0;

                    eliteCurMaxHealth = elite.Key.MaxHealth;

                    same = 0;

                    foreach (var monster2 in monsters)

                    {
                        if (eliteMaxHealth < monster2.MaxHealth && monster2.Rarity == ActorRarity.Champion)
                        {
                            eliteMaxHealth = monster2.MaxHealth;
                        }
                    }

                    foreach (var monster1 in monsters)

                    {
                        if (monster1.Rarity == ActorRarity.Champion)

                        {
                            if (eliteCurMaxHealth == monster1.MaxHealth)
                            {
                                same++;
                            }

                            if (same == 2)

                            {
                                illusionist = true;

                                break;
                            }
                        }
                    }

                    if (illusionist == false)

                    {
                        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;

                        //BorderBrush.DrawRectangle(x, y, 70, h);

                        BackgroundBrush.DrawRectangle(Hud.Window.Size.Width * 0.125f, y, w2, h);

                        TextFont.DrawText(layout, Hud.Window.Size.Width * 0.125f + px + w2, y - py);

                        ChampionBrush.DrawRectangle(Hud.Window.Size.Width * 0.125f, y, (float)w, h);

                        preStr = elite.Value;

                        count++;
                    }
                }

                if (elite.Key.Rarity == ActorRarity.Rare)

                {
                    var eliteCurMaxHealth = 0.0d;

                    var eliteMaxHealth = 0.0d;

                    bool illusionist = false;

                    int same = 0;

                    eliteCurMaxHealth = elite.Key.MaxHealth;

                    same = 0;

                    foreach (var monster2 in monsters)

                    {
                        if (eliteMaxHealth < monster2.MaxHealth && monster2.Rarity == ActorRarity.Rare)
                        {
                            eliteMaxHealth = monster2.MaxHealth;
                        }
                    }

                    foreach (var monster1 in monsters)

                    {
                        if (monster1.Rarity == ActorRarity.Rare)

                        {
                            if (eliteCurMaxHealth == monster1.MaxHealth)
                            {
                                same++;
                            }

                            if (same == 2)

                            {
                                illusionist = true;

                                break;
                            }
                        }
                    }

                    if (illusionist == false)

                    {
                        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;

                        //BorderBrush.DrawRectangle(x, y, 70, h);

                        BackgroundBrush.DrawRectangle(Hud.Window.Size.Width * 0.125f, y, w2, h);

                        TextFont.DrawText(layout, Hud.Window.Size.Width * 0.125f + px + w2, y - py);

                        RareBrush.DrawRectangle(Hud.Window.Size.Width * 0.125f, y, (float)w, h);

                        preStr = elite.Value;

                        count++;
                    }
                }
            }

            eliteGroup.Clear();
        }
Exemplo n.º 23
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);
            }
        }