Exemplo n.º 1
0
 public int monsterDensityAroundCursor(float distance)
 {
     if (!Hud.Game.Me.IsInTown)
     {
         IScreenCoordinate coord = Hud.Game.Me.FloorCoordinate.ToScreenCoordinate(); //Hud.Render.GetCursorPos();
         coord.X = Hud.Window.CursorX;
         coord.Y = 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)
         {
             cursorBrush.DrawWorldEllipse(distance, -1, cursor);
         }
         if (drawCursorLabel)
         {
             cursorDecorator.Paint(Hud.Window.CursorX - 10, Hud.Window.CursorY + 30, 50, 20, count.ToString(), null, "");
         }
         return(count);
     }
     return(0);
 }
Exemplo n.º 2
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));
         }
     }
 }
Exemplo n.º 3
0
        private void DrawLine(IScreenCoordinate objectPosition, Line line, bool grey)
        {
            var start = PointOnLine(Center.X, Center.Y, objectPosition.X, objectPosition.Y, 60);
            var end   = PointOnLine(objectPosition.X, objectPosition.Y - 30, Center.X, Center.Y, 20);

            if (grey)
            {
                GreyBrush.DrawLine(start.X, start.Y, end.X, end.Y, StrokeWidth * 0.5f);
                return;
            }

            switch (line.Anim)
            {
            case Line.AnimType.None:
                line.Brush.DrawLine(start.X, start.Y, end.X, end.Y, StrokeWidth * 0.8f);
                break;

            case Line.AnimType.Blink:
                if ((Hud.Game.CurrentRealTimeMilliseconds / 700) % 2 == 0)
                {
                    line.Brush.DrawLine(start.X, start.Y, end.X, end.Y, StrokeWidth * 0.6f);
                }
                break;

            case Line.AnimType.Fade:
                line.Brush.Opacity = _opacity;
                line.Brush.DrawLine(start.X, start.Y, end.X, end.Y, StrokeWidth * 0.8f);
                break;

            case Line.AnimType.WidthMod:
                line.Brush.DrawLine(start.X, start.Y, end.X, end.Y, StrokeWidth * _lineWidth);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        private void Draw(IWorldCoordinate coord, float startAngle, float endAngle, int sectionsCount,
                          float missingPercent, IBrush bgBrush, IBrush brush)
        {
            var fullAngleRange = endAngle - startAngle;
            var halfRange      = fullAngleRange / 2f;
            var angleStep      = fullAngleRange / sectionsCount;
            var halfStroke     = Stroke / 2f;

            var start = Math.Max(startAngle, startAngle + halfRange * missingPercent);
            var end   = Math.Min(endAngle, endAngle - halfRange * missingPercent);

            if (start > end || start < 0 || end < 0 || start > 360)
            {
                return;
            }

            IScreenCoordinate previousCoord = default(IScreenCoordinate);

            for (var angle = start; angle <= end; angle += angleStep)
            {
                if (angle + angleStep > end) //if it's the last step
                {
                    angle = end;
                }

                //convert to radiant for ease of use, and set top == 0f, counter clockwise up to 360.
                var radians = (angle - 135f) * Math.PI / 180.0f;
                var cos     = (float)Math.Cos(radians);
                var sin     = (float)Math.Sin(radians);

                var mx = (Radius + halfStroke) * cos;
                var my = (Radius + halfStroke) * sin;

                if (previousCoord == default(IScreenCoordinate))
                {
                    previousCoord = coord.Offset(mx, my, 0).ToScreenCoordinate();
                    continue;
                }

                var currentCoord = coord.Offset(mx, my, 0).ToScreenCoordinate();

                brush.DrawLine(previousCoord.X, previousCoord.Y, currentCoord.X, currentCoord.Y);

                previousCoord = currentCoord;
            }

            return;

            using (var pg = Hud.Render.CreateGeometry())
            {
                using (var gs = pg.Open())
                {
                    var outerVectors    = new List <Vector2>();
                    var innerVectors    = new List <Vector2>();
                    var capsCoordinates = new List <IWorldCoordinate>();

                    for (var angle = start; angle <= end; angle += angleStep)
                    {
                        if (angle + angleStep > end) //if it's the last step
                        {
                            angle = end;
                        }

                        //convert to radiant for ease of use, and set top == 0f, counter clockwise up to 360.
                        var radians = (angle - 135f) * Math.PI / 180.0f;
                        var cos     = (float)Math.Cos(radians);
                        var sin     = (float)Math.Sin(radians);

                        if (angle == start || angle == end)
                        {
                            capsCoordinates.Add(coord.Offset(Radius * cos, Radius * sin, 0));
                        }

                        //outer point
                        var mx = (Radius + halfStroke) * cos;
                        var my = (Radius + halfStroke) * sin;

                        var vector = coord.ToVector2(mx, my, 0);
                        outerVectors.Add(vector);

                        //inner point
                        var mx2 = (Radius - halfStroke) * cos;
                        var my2 = (Radius - halfStroke) * sin;

                        vector = coord.ToVector2(mx2, my2, 0);
                        innerVectors.Add(vector);
                    }

                    gs.BeginFigure(outerVectors.First(), FigureBegin.Filled);
                    foreach (var v in outerVectors.Skip(1))
                    {
                        gs.AddLine(v);
                    }

                    ////TODO: if rounded cap, add half circle
                    //var capCoord = capsCoordinates.Last();
                    //for (var angle = 135f; angle < 315f; angle += 1f)
                    //{
                    //    if (angle + angleStep > end) //if it's the last step
                    //        angle = end;

                    //    //convert to radiant for ease of use, and set top == 0f, counter clockwise up to 360.
                    //    var radians = angle * Math.PI / 180.0f;
                    //    var cos = (float)Math.Cos(radians);
                    //    var sin = (float)Math.Sin(radians);

                    //    var mx = halfStroke * cos;
                    //    var my = halfStroke * sin;

                    //    var vector = capCoord.ToVector2(mx - 3, my - 3, 0);
                    //    gs.AddLine(vector);
                    //}

                    innerVectors.Reverse();
                    foreach (var v in innerVectors)
                    {
                        gs.AddLine(v);
                    }

                    //TODO: if rounded cap, add half circle

                    gs.EndFigure(FigureEnd.Closed);

                    //gs.BeginFigure(capsCoordinates.Last().ToVector2(), FigureBegin.Filled);
                    //var capCoord = capsCoordinates.Last();
                    //for (var angle = 90f; angle < 270f; angle += 9f)
                    //{
                    //    if (angle + angleStep > end) //if it's the last step
                    //        angle = end;

                    //    //convert to radiant for ease of use, and set top == 0f, counter clockwise up to 360.
                    //    var radians = angle * Math.PI / 180.0f;
                    //    var cos = (float)Math.Cos(radians);
                    //    var sin = (float)Math.Sin(radians);

                    //    var mx = halfStroke * cos;
                    //    var my = halfStroke * sin;

                    //    var vector = capCoord.ToVector2(mx, my, 0);
                    //    gs.AddLine(vector);
                    //}
                    //gs.EndFigure(FigureEnd.Closed);

                    //
                    gs.Close();

                    if (bgBrush != null)
                    {
                        bgBrush.DrawGeometry(pg);
                    }

                    brush.DrawGeometry(pg);
                }
            }
        }
Exemplo n.º 5
0
        public void PaintWorld(WorldLayer layer)
        {
            foreach (var marker in Hud.Game.Markers)
            {
                if (showDirectionLine && marker.SnoActor != null)
                {
                    if (marker.SnoActor.Code.Contains("Boss"))
                    {
                        BossDirectionLineDecorator.ToggleDecorators <GroundLabelDecorator>(!marker.FloorCoordinate.IsOnScreen());                        // do not display ground labels when the marker is on the screen
                        BossDirectionLineDecorator.Paint(layer, null, marker.FloorCoordinate, marker.Name);
                    }
                }
            }
            var monsters = Hud.Game.AliveMonsters;

            foreach (var monster in monsters)
            {
                if (monster.Rarity == ActorRarity.Boss && monster.SummonerAcdDynamicId == 0)
                {
                    if (showDirectionLine && showMiniMapLine)
                    {
                        BossDirectionLineDecorator.ToggleDecorators <GroundLabelDecorator>(!monster.FloorCoordinate.IsOnScreen()); // do not display ground labels when the marker is on the screen
                        BossDirectionLineDecorator.Paint(layer, null, monster.FloorCoordinate, null);
                    }
                    if (showDirectionLine && showGroundLine)
                    {
                        IScreenCoordinate boss = Hud.Window.CreateScreenCoordinate(monster.FloorCoordinate.ToScreenCoordinate().X, monster.FloorCoordinate.ToScreenCoordinate().Y);
                        Hud.Render.CreateBrush(192, 255, 255, 55, -1).DrawLine(boss.X, boss.Y, Hud.Game.Me.ScreenCoordinate.X, Hud.Game.Me.ScreenCoordinate.Y + 60, 1.0f);
                    }
                    if ((showCCoffMessage) && (!monster.Frozen && !monster.Chilled && !monster.Slow && !monster.Stunned && !monster.Blind))
                    {
                        var    CCofftime     = (Hud.Game.CurrentGameTick - CCoffStarttick) / 60.0d;
                        String CCofftimetext = "CC 없음 " + Math.Truncate(CCofftime) + "초";;
                        if (!CCofftimerRunning)
                        {
                            CCoffStarttick    = Hud.Game.CurrentGameTick;
                            CCofftimerRunning = true;
                        }
                        BossCCDecorator.Paint(layer, monster, monster.FloorCoordinate.Offset(0, 0, offset), CCofftimetext);
                    }

                    if ((showCCoffMessage) && (monster.Frozen || monster.Chilled || monster.Slow || monster.Stunned || monster.Blind))
                    {
                        if (CCofftimerRunning)
                        {
                            CCofftimerRunning = false;
                        }
                    }
                    string data1 = "";
                    if (monster.Frozen && showCC)
                    {
                        data1 += "빙결";
                        BossCCDecorator.Paint(layer, monster, monster.FloorCoordinate.Offset(0, 0, offset), data1);
                    }
                    if (monster.Chilled && showCC)
                    {
                        data1 += " 오한";
                        BossCCDecorator.Paint(layer, monster, monster.FloorCoordinate.Offset(0, 0, offset), data1);
                    }
                    if (monster.Slow && showCC)
                    {
                        data1 += " 느림";
                        BossCCDecorator.Paint(layer, monster, monster.FloorCoordinate.Offset(0, 0, offset), data1);
                    }
                    if (monster.Stunned && showCC)
                    {
                        data1 += " 기절";
                        BossCCDecorator.Paint(layer, monster, monster.FloorCoordinate.Offset(0, 0, offset), data1);
                    }
                    if (monster.Blind && showCC)
                    {
                        data1 += " 실명";
                        BossCCDecorator.Paint(layer, monster, monster.FloorCoordinate.Offset(0, 0, offset), data1);
                    }
                    if (monster.Locust && showDebuff)
                    {
                        data1 += " 메뚜기";
                        BossDebuffDecorator.Paint(layer, monster, monster.FloorCoordinate.Offset(0, 0, offset), data1);
                    }
                    if (monster.Haunted && showDebuff)
                    {
                        data1 += " 혼출";
                        BossDebuffDecorator.Paint(layer, monster, monster.FloorCoordinate.Offset(0, 0, offset), data1);
                    }
                    if (monster.Palmed && showDebuff)
                    {
                        data1 += " 폭장";
                        BossDebuffDecorator.Paint(layer, monster, monster.FloorCoordinate.Offset(0, 0, offset), data1);
                    }
                    if (monster.MarkedForDeath && showDebuff)
                    {
                        data1 += " 죽표";
                        BossDebuffDecorator.Paint(layer, monster, monster.FloorCoordinate.Offset(0, 0, offset), data1);
                    }
                    if (monster.Strongarmed && showDebuff)
                    {
                        data1 += " 팔씨름";
                        BossDebuffDecorator.Paint(layer, monster, monster.FloorCoordinate.Offset(0, 0, offset), data1);
                    }
                }
            }
        }