Esempio n. 1
0
        public static void Draw()
        {
            try
            {
                if (Menu == null || _champion.Spells == null || !Utils.ShouldDraw())
                {
                    return;
                }

                var circleThickness = Menu.Item(Menu.Name + ".circle-thickness").GetValue <Slider>().Value;
                foreach (
                    var spell in _champion.Spells.Where(s => s != null && s.Range > 0 && s.Range < 5000 && s.Level > 0))
                {
                    if (spell.IsChargedSpell)
                    {
                        var min =
                            Menu.Item(Menu.Name + "." + spell.Slot.ToString().ToLower() + "-min").GetValue <Circle>();
                        var max =
                            Menu.Item(Menu.Name + "." + spell.Slot.ToString().ToLower() + "-max").GetValue <Circle>();
                        if (min.Active && ObjectManager.Player.Position.IsOnScreen(spell.ChargedMinRange))
                        {
                            Render.Circle.DrawCircle(
                                ObjectManager.Player.Position, spell.ChargedMinRange, min.Color, circleThickness);
                        }
                        if (max.Active && ObjectManager.Player.Position.IsOnScreen(spell.ChargedMaxRange))
                        {
                            Render.Circle.DrawCircle(
                                ObjectManager.Player.Position, spell.ChargedMaxRange, max.Color, circleThickness);
                        }
                    }
                    else
                    {
                        var item = Menu.Item(Menu.Name + "." + spell.Slot.ToString().ToLower()).GetValue <Circle>();
                        if (item.Active && ObjectManager.Player.Position.IsOnScreen(spell.Range))
                        {
                            Render.Circle.DrawCircle(
                                ObjectManager.Player.Position, spell.Range, item.Color, circleThickness);
                        }
                    }
                }

                foreach (var custom in Customs)
                {
                    var item = Menu.Item(Menu.Name + "." + custom.Key).GetValue <Circle>();
                    if (item.Active && ObjectManager.Player.Position.IsOnScreen(custom.Value))
                    {
                        Render.Circle.DrawCircle(
                            ObjectManager.Player.Position, custom.Value, item.Color, circleThickness);
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
        private static void DrawingOnEndScene(EventArgs args)
        {
            try
            {
                if (Drawing.Direct3DDevice == null || Drawing.Direct3DDevice.IsDisposed || !Utils.ShouldDraw())
                {
                    return;
                }

                if (_line != null && !_line.IsDisposed)
                {
                    if (_menu == null || !_menu.Item(_menu.Name + ".enabled").GetValue <bool>())
                    {
                        return;
                    }
                    var color      = _menu.Item(_menu.Name + ".color").GetValue <Color>();
                    var alpha      = (byte)(_menu.Item(_menu.Name + ".opacity").GetValue <Slider>().Value * 255 / 100);
                    var sharpColor = new ColorBGRA(color.R, color.G, color.B, alpha);
                    foreach (var unit in
                             GameObjects.EnemyHeroes.Where(
                                 u => u.IsHPBarRendered && u.Position.IsOnScreen() && u.IsValidTarget()))
                    {
                        var damage = CalculateDamage(unit);
                        if (damage <= 0)
                        {
                            continue;
                        }
                        var damagePercentage        = (unit.Health - damage > 0 ? unit.Health - damage : 0) / unit.MaxHealth;
                        var currentHealthPercentage = unit.Health / unit.MaxHealth;
                        var startPoint =
                            new Vector2(
                                (int)(unit.HPBarPosition.X + BarOffset.X + damagePercentage * BarWidth),
                                (int)(unit.HPBarPosition.Y + BarOffset.Y) - 5);
                        var endPoint =
                            new Vector2(
                                (int)(unit.HPBarPosition.X + BarOffset.X + currentHealthPercentage * BarWidth) + 1,
                                (int)(unit.HPBarPosition.Y + BarOffset.Y) - 5);
                        _line.Begin();
                        _line.Draw(new[] { startPoint, endPoint }, sharpColor);
                        _line.End();
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }