Esempio n. 1
0
        protected virtual void Drawing_OnDraw(EventArgs arg)
        {
            if (!Champion.Menu.Item("enableCustMenu", true).GetValue <bool>())
            {
                return;
            }

            if (Champion.Menu.Item("custMenu", true).GetValue <KeyBind>().Active)
            {
                _menuX = (int)Drawing.WorldToScreen(Game.CursorPos).X;
                _menuY = (int)Drawing.WorldToScreen(Game.CursorPos).Y;
            }

            var yOffset = 0;

            foreach (var obj in MyPermaMenus)
            {
                if (obj != null)
                {
                    if (obj.MenuItem.GetValue <bool>())
                    {
                        obj.RenderTxt.X = _menuX;
                        obj.RenderTxt.Y = _menuY + yOffset;

                        if (Champion.Menu.Item(obj.Source, true).GetValue <KeyBind>().Active)
                        {
                            obj.RenderTxt.Color = new ColorBGRA(209, 179, 40, 255);
                            obj.RenderTxt.text  = obj.Text + "On";
                        }
                        else
                        {
                            obj.RenderTxt.Color = new ColorBGRA(255, 0, 0, 255);
                            obj.RenderTxt.text  = obj.Text + "Off";
                        }

                        obj.RenderTxt.OnEndScene();
                        yOffset += 20;
                    }
                }
            }

            //sprite
            MySprite.X = _menuX - 12;
            MySprite.Y = _menuY - 35;
            MySprite.OnEndScene();

            //line 1
            MyLine.Start = new Vector2(_menuX - 10, _menuY - 10);
            MyLine.End   = new Vector2(_menuX - 10, _menuY + yOffset + 10);
            MyLine.OnEndScene();

            //line 2
            MyLine2.Start = new Vector2(_menuX + 135, _menuY - 10);
            MyLine2.End   = new Vector2(_menuX + 135, _menuY + yOffset + 10);
            MyLine2.OnEndScene();

            //line 3
            MyLine3.Start = new Vector2(_menuX + 135, _menuY - 10);
            MyLine3.End   = new Vector2(_menuX - 10, _menuY - 10);
            MyLine3.OnEndScene();

            //line 3
            MyLine4.Start = new Vector2(_menuX + 135, _menuY + yOffset + 10);
            MyLine4.End   = new Vector2(_menuX - 10, _menuY + yOffset + 10);
            MyLine4.OnEndScene();
        }
Esempio n. 2
0
        private static void Drawing_OnEndScene(EventArgs args)
        {
            try
            {
                foreach (var hero in
                         HeroManager.AllHeroes.Where(
                             hero =>
                             hero.IsValid && !hero.IsMe && hero.IsHPBarRendered &&
                             (hero.IsEnemy && Config.Item("TrackEnemies").GetValue <bool>() ||
                              hero.IsAlly && Config.Item("TrackAllies").GetValue <bool>())))
                {
                    var pos = GetHPBarPositionWithOffset(hero);
                    var X   = (int)pos.X;
                    var Y   = (int)pos.Y;

                    var k = 0;

                    foreach (var sSlot in SummonerSpellSlots)
                    {
                        var spell   = hero.Spellbook.GetSpell(sSlot);
                        var texture = SummonerTextures[spell.Name];
                        var t       = spell.CooldownExpires - Game.Time;
                        var percent = Math.Abs(spell.Cooldown) > float.Epsilon ? t / spell.Cooldown : 1f;
                        var n       = t > 0 ? (int)(19 * (1f - percent)) : 19;
                        var ts      = TimeSpan.FromSeconds((int)t);
                        var s       = t > 60 ? string.Format("{0}:{1:D2}", ts.Minutes, ts.Seconds) : string.Format("{0:0}", t);

                        if (t > 0)
                        {
                            Text.text  = s;
                            Text.X     = X - 5 - s.Length * 5;
                            Text.Y     = Y + 1 + 13 * k;
                            Text.Color = Color.White;
                            Text.OnEndScene();
                        }

                        texture.X = X + 3 + (Config.Item("XmasHud").IsActive() ? 1 : 0);
                        texture.Y = Y + 1 + 13 * k;
                        var crop = Config.Item("XmasHud").IsActive() ? 14 : 12;
                        texture.Crop(new Rectangle(0, 12 * n, crop, 12));
                        texture.OnEndScene();
                        k++;
                    }

                    var hudOffset = GetHudOffset();
                    CdFrame.X = X + (int)hudOffset.X;
                    CdFrame.Y = Y + (int)hudOffset.Y;
                    CdFrame.OnEndScene();

                    var miscOffset = GetMiscOffset();
                    var startX     = X + 19 + (int)miscOffset.X;
                    var startY     = Y + 20 + (int)miscOffset.Y;

                    foreach (var slot in SpellSlots)
                    {
                        var spell   = hero.Spellbook.GetSpell(slot);
                        var t       = spell.CooldownExpires - Game.Time;
                        var percent = t > 0 && Math.Abs(spell.Cooldown) > float.Epsilon ? 1f - t / spell.Cooldown : 1f;

                        if (t > 0 && t < 100)
                        {
                            var s = string.Format(t < 1f ? "{0:0.0}" : "{0:0}", t);
                            Text.text  = s;
                            Text.X     = startX + (24 - s.Length * 4) / 2;
                            Text.Y     = startY + 6;
                            Text.Color = Color.White;
                            Text.OnEndScene();
                        }

                        var darkColor  = t > 0 ? new ColorBGRA(168, 98, 0, 255) : new ColorBGRA(0, 130, 15, 255);
                        var lightColor = t > 0 ? new ColorBGRA(235, 137, 0, 255) : new ColorBGRA(0, 168, 25, 255);

                        if (hero.Spellbook.CanUseSpell(slot) != SpellState.NotLearned)
                        {
                            for (var i = 0; i < 2 + (Config.Item("XmasHud").IsActive() ? 1 : 0); i++)
                            {
                                ReadyLine.Start = new Vector2(startX, startY + i * 2);
                                ReadyLine.End   = new Vector2(startX + percent * 23, startY + i * 2);
                                ReadyLine.Color = i == 0 ? lightColor : darkColor;
                                ReadyLine.OnEndScene();
                            }
                        }

                        startX = startX + 27;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(@"/ff can't draw sprites: " + e);
            }
        }
Esempio n. 3
0
        private static void Drawing_OnEndScene(EventArgs args)
        {
            try
            {
                var screenWidth  = Drawing.Width;
                var screenHeight = Drawing.Height;

                foreach (var hero in
                         LeagueSharp.Common.HeroManager.AllHeroes.Where(
                             hero =>
                             hero.IsValid && !hero.IsMe && hero.IsHPBarRendered &&
                             (hero.IsEnemy && Program.getCheckBoxItem(Program.cd, "TrackEnemies") ||
                              hero.IsAlly && Program.getCheckBoxItem(Program.cd, "TrackAllies"))))
                {
                    var pos = GetHPBarPositionWithOffset(hero);
                    var X   = (int)pos.X - 10;
                    var Y   = (int)pos.Y - 13;

                    if (X < -300 || X > screenWidth + 300 || Y < -300 || Y > screenHeight + 300)
                    {
                        continue;
                    }

                    var k = 0;

                    foreach (var sSlot in SummonerSpellSlots)
                    {
                        var spell   = hero.Spellbook.GetSpell(sSlot);
                        var texture = SummonerTextures.ContainsKey(spell.Name)
                            ? SummonerTextures[spell.Name]
                            : SummonerTextures["SummonerBarrier"];
                        var t       = spell.CooldownExpires - Game.Time;
                        var percent = Math.Abs(spell.Cooldown) > float.Epsilon ? t / spell.Cooldown : 1f;
                        var n       = t > 0 ? (int)(19 * (1f - percent)) : 19;
                        var ts      = TimeSpan.FromSeconds((int)t);
                        var s       = t > 60 ? string.Format("{0}:{1:D2}", ts.Minutes, ts.Seconds) : string.Format("{0:0}", t);

                        if (t > 0)
                        {
                            Text.text  = s;
                            Text.X     = X - 5 - s.Length * 5;
                            Text.Y     = Y + 1 + 13 * k;
                            Text.Color = Color.White;
                            Text.OnEndScene();
                        }

                        texture.X = X + 3;
                        texture.Y = Y + 1 + 13 * k;
                        var crop = 12;
                        texture.Crop(new Rectangle(0, 12 * n, crop, 12));
                        texture.OnEndScene();
                        k++;
                    }

                    CdFrame.X = X;
                    CdFrame.Y = Y;
                    CdFrame.OnEndScene();

                    var startX = X + 19;
                    var startY = Y + 20;

                    foreach (var slot in SpellSlots)
                    {
                        var spell   = hero.Spellbook.GetSpell(slot);
                        var t       = spell.CooldownExpires - Game.Time;
                        var percent = t > 0 && Math.Abs(spell.Cooldown) > float.Epsilon ? 1f - t / spell.Cooldown : 1f;

                        if (t > 0 && t < 100)
                        {
                            var s = string.Format(t < 1f ? "{0:0.0}" : "{0:0}", t);
                            Text.text  = s;
                            Text.X     = startX + (24 - s.Length * 4) / 2;
                            Text.Y     = startY + 6;
                            Text.Color = Color.White;
                            Text.OnEndScene();
                        }

                        var darkColor  = t > 0 ? new ColorBGRA(168, 98, 0, 255) : new ColorBGRA(0, 130, 15, 255);
                        var lightColor = t > 0 ? new ColorBGRA(235, 137, 0, 255) : new ColorBGRA(0, 168, 25, 255);

                        if (hero.Spellbook.CanUseSpell(slot) != SpellState.NotLearned)
                        {
                            for (var i = 0; i < 2; i++)
                            {
                                ReadyLine.Start = new Vector2(startX, startY + i * 2);
                                ReadyLine.End   = new Vector2(startX + percent * 23, startY + i * 2);
                                ReadyLine.Color = i == 0 ? lightColor : darkColor;
                                ReadyLine.OnEndScene();
                            }
                        }

                        startX = startX + 27;
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(@"/ff can't draw sprites: " + e);
            }
        }