Ejemplo n.º 1
0
 public void PaintWorld(WorldLayer layer)
 {
     if (!Hud.Game.Me.IsInTown)
     {
         IScreenCoordinate coord  = Hud.Window.CreateScreenCoordinate(Hud.Window.CursorX, Hud.Window.CursorY);
         IWorldCoordinate  cursor = coord.ToWorldCoordinate();
         int count = 0;
         foreach (IMonster monster in Hud.Game.AliveMonsters)
         {
             if (monster.FloorCoordinate.XYDistanceTo(cursor) < Distance)
             {
                 count++;
             }
         }
         if (DrawCursorCircle)
         {
             CursorCircleBrush.DrawWorldEllipse(Distance, -1, cursor);
         }
         if (DrawCursorLabel)
         {
             float width  = Hud.Window.Size.Height * CursorLabelWRatio;
             float height = Hud.Window.Size.Height * CursorLabelHRatio;
             CursorLabelDecorator.Paint(coord.X + CursorLabelXOffset, coord.Y + CursorLabelYOffset, width, height, count.ToString(), null, "");
         }
         if (DrawTopLabel)
         {
             float x      = Hud.Window.Size.Width * TopLabelXRatio;
             float y      = Hud.Window.Size.Height * TopLabelYRatio;
             float width  = Hud.Window.Size.Height * TopLabelWRatio;
             float height = Hud.Window.Size.Height * TopLabelHRatio;
             TopLabelDecorator.Paint(x - width / 2, y, width, height, count.ToString(), null, "");
         }
         if (DrawCursorLine)
         {
             var player = Hud.Game.Me.ScreenCoordinate;
             LineBrush.DrawLine(player.X, player.Y, coord.X, coord.Y);
         }
         if (DrawDistanceLabel)
         {
             var   distance = Hud.Game.Me.FloorCoordinate.XYDistanceTo(cursor);
             float x        = Hud.Window.Size.Width * DistanceLabelXRatio;
             float y        = Hud.Window.Size.Height * DistanceLabelYRatio;
             float width    = Hud.Window.Size.Height * DistanceLabelWRatio;
             float height   = Hud.Window.Size.Height * DistanceLabelHRatio;
             TopLabelDecorator.Paint(x - width / 2, y, width, height, distance.ToString("F1", CultureInfo.InvariantCulture));
         }
     }
 }
Ejemplo n.º 2
0
        public void PaintTopInGame(ClipState clipState)
        {
            if (clipState != ClipState.BeforeClip)
            {
                return;
            }

            var uiBar = Hud.Render.MonsterHpBarUiElement;

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

            if ((monster == null) || (uiBar == null))
            {
                return;
            }
            var hpText = GLQ_BasePluginCN.ValueToString(monster.CurHealth, ValueFormat.LongNumber) + " / " + GLQ_BasePluginCN.ValueToString(monster.MaxHealth, ValueFormat.LongNumber);

            hpText += " - " + GLQ_BasePluginCN.ValueToString(monster.CurHealth / (monster.MaxHealth / 100.0f), ValueFormat.LongNumber) + "%";

            var textLayout = MonsterHitpointsFont.GetTextLayout(hpText);

            MonsterHitpointsFont.DrawText(textLayout, uiBar.Rectangle.Left + (uiBar.Rectangle.Width - textLayout.Metrics.Width) / 2, uiBar.Rectangle.Top + (uiBar.Rectangle.Height - textLayout.Metrics.Height) / 2);

            string textCC = null;

            if (monster.Frozen)
            {
                textCC += (textCC == null ? "" : ", ") + "冰冻";
            }
            if (monster.Chilled)
            {
                textCC += (textCC == null ? "" : ", ") + "寒冷";
            }
            if (monster.Slow)
            {
                textCC += (textCC == null ? "" : ", ") + "减速";
            }
            if (monster.Stunned)
            {
                textCC += (textCC == null ? "" : ", ") + "昏迷";
            }
            if (monster.Invulnerable)
            {
                BorderBrush.DrawRectangle(uiBar.Rectangle.Left, uiBar.Rectangle.Top, uiBar.Rectangle.Width, uiBar.Rectangle.Height);
                textCC += (textCC == null ? "" : ", ") + "无敌";
            }

            if (monster.Blind)
            {
                textCC += (textCC == null ? "" : ", ") + "致盲";
            }

            string textDebuff = null;

            if (monster.Locust)
            {
                textDebuff += (textDebuff == null ? "" : ", ") + "虫群";
            }
            if (monster.Palmed)
            {
                textDebuff += (textDebuff == null ? "" : ", ") + "爆裂掌";
            }
            if (monster.Haunted)
            {
                textDebuff += (textDebuff == null ? "" : ", ") + "蚀魂";
            }
            if (monster.MarkedForDeath)
            {
                textDebuff += (textDebuff == null ? "" : ", ") + "标记";
            }
            if (monster.Strongarmed)
            {
                textDebuff += (textDebuff == null ? "" : ", ") + "力士";
            }
            if (monster.Phoenixed)
            {
                textDebuff += (textDebuff == null ? "" : ", ") + "火鸟";
            }
            if (isKrysbin(monster))
            {
                textDebuff += (textDebuff == null ? "" : ", ") + "克利斯宾";
            }
            var text = textCC + (textCC != null && textDebuff != null ? " | " : "") + textDebuff;

            if (monster.DotDpsApplied > 0)
            {
                text += (string.IsNullOrEmpty(text) ? "" : " | ") + "DOT: " + GLQ_BasePluginCN.ValueToString(monster.DotDpsApplied, ValueFormat.LongNumber);
            }
            if (text != null)
            {
                textLayout = MonsterEffectsFont.GetTextLayout(text);
                MonsterEffectsFont.DrawText(textLayout, uiBar.Rectangle.Left + (uiBar.Rectangle.Width - textLayout.Metrics.Width) / 2, uiBar.Rectangle.Top - (uiBar.Rectangle.Height * 0.38f) - textLayout.Metrics.Height);
            }
            if (monster.SummonerAcdDynamicId != 0 && monster.IsElite)
            {
                LineBrush.DrawLine(uiBar.Rectangle.Left, uiBar.Rectangle.Top - uiBar.Rectangle.Height * 1.5f, uiBar.Rectangle.Right, uiBar.Rectangle.Top + uiBar.Rectangle.Height + uiBar.Rectangle.Height * 1.5f, 0);
                LineBrush.DrawLine(uiBar.Rectangle.Left, uiBar.Rectangle.Top + uiBar.Rectangle.Height + uiBar.Rectangle.Height * 1.5f, uiBar.Rectangle.Right, uiBar.Rectangle.Top - uiBar.Rectangle.Height * 1.5f, 0);
            }
        }