Exemplo n.º 1
0
        private static void Drawing_OnEndScene(EventArgs args)
        {
            if (Drawing.Direct3DDevice == null || Drawing.Direct3DDevice.IsDisposed)
            {
                return;
            }

            try
            {
                if (Sprite.IsDisposed)
                {
                    return;
                }

                foreach (var hero in
                         ObjectManager.Get <Obj_AI_Hero>()
                         .Where(
                             hero =>
                             hero != null && hero.IsValid && (!hero.IsMe || Config.Item("TrackMe").GetValue <bool>()) &&
                             hero.IsHPBarRendered &&
                             (hero.IsEnemy && Config.Item("TrackEnemies").GetValue <bool>() ||
                              hero.IsAlly && Config.Item("TrackAllies").GetValue <bool>())))
                {
                    Sprite.Begin();

                    var indicator = new HpBarIndicator {
                        Unit = hero
                    };

                    X = (int)indicator.Position.X;
                    Y = (int)indicator.Position.Y;

                    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.DrawText(
                                null, s, X - 5 - s.Length * 5, Y + 1 + 13 * k, new ColorBGRA(255, 255, 255, 255));
                        }

                        Sprite.Draw(
                            texture, new ColorBGRA(255, 255, 255, 255), new SharpDX.Rectangle(0, 12 * n, 12, 12),
                            new Vector3(-X - 3, -Y - 1 - 13 * k, 0));
                        k++;
                    }

                    Sprite.Draw(CdFrameTexture, new ColorBGRA(255, 255, 255, 255), null, new Vector3(-X, -Y, 0));
                    Sprite.End();

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

                    ReadyLine.Begin();
                    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.DrawText(
                                null, s, startX + (23 - s.Length * 4) / 2, startY + 6, new ColorBGRA(255, 255, 255, 255));
                        }

                        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.Draw(
                                    new[]
                                {
                                    new Vector2(startX, startY + i * 2),
                                    new Vector2(startX + percent * 23, startY + i * 2)
                                },
                                    i == 0 ? lightColor : darkColor);
                            }
                        }

                        startX = startX + 27;
                    }
                    ReadyLine.End();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(@"/ff can't draw sprites: " + e);
            }
        }
Exemplo n.º 2
0
        private static void Drawing_OnEndScene(EventArgs args)
        {
            if (Drawing.Direct3DDevice == null || Drawing.Direct3DDevice.IsDisposed)
            {
                return;
            }

            try
            {
                if (Sprite.IsDisposed)
                {
                    return;
                }

                foreach (var hero in
                    ObjectManager.Get<Obj_AI_Hero>()
                        .Where(
                            hero =>
                                hero != null && hero.IsValid && (!hero.IsMe || Config.Item("TrackMe").GetValue<bool>()) &&
                                hero.IsHPBarRendered &&
                                (hero.IsEnemy && Config.Item("TrackEnemies").GetValue<bool>() ||
                                 hero.IsAlly && Config.Item("TrackAllies").GetValue<bool>())))
                {
                    Sprite.Begin();

                    var indicator = new HpBarIndicator { Unit = hero };

                    X = (int) indicator.Position.X;
                    Y = (int) indicator.Position.Y;

                    var k = 0;
                    foreach (var sSlot in SummonerSpellSlots)
                    {
                        var spell = hero.SummonerSpellbook.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.DrawText(
                                null, s, X - 5 - s.Length * 5, Y + 1 + 13 * k, new ColorBGRA(255, 255, 255, 255));
                        }

                        Sprite.Draw(
                            texture, new ColorBGRA(255, 255, 255, 255), new SharpDX.Rectangle(0, 12 * n, 12, 12),
                            new Vector3(-X - 3, -Y - 1 - 13 * k, 0));
                        k++;
                    }

                    Sprite.Draw(CdFrameTexture, new ColorBGRA(255, 255, 255, 255), null, new Vector3(-X, -Y, 0));
                    Sprite.End();

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

                    ReadyLine.Begin();
                    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.DrawText(
                                null, s, startX + (23 - s.Length * 4) / 2, startY + 6, new ColorBGRA(255, 255, 255, 255));
                        }

                        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.Draw(
                                    new[]
                                    {
                                        new Vector2(startX, startY + i * 2),
                                        new Vector2(startX + percent * 23, startY + i * 2)
                                    },
                                    i == 0 ? lightColor : darkColor);
                            }
                        }

                        startX = startX + 27;
                    }
                    ReadyLine.End();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(@"/ff can't draw sprites: " + e);
            }
        }
Exemplo n.º 3
0
        private static void Drawing_OnEndScene(EventArgs args)
        {
            try
            {
                foreach (var hero in
                    HeroManager.AllHeroes.Where(
                        hero =>
                            hero != null && hero.IsValid && !hero.IsMe && hero.IsHPBarRendered &&
                            (hero.IsEnemy && Config.Item("TrackEnemies").GetValue<bool>() ||
                             hero.IsAlly && Config.Item("TrackAllies").GetValue<bool>())))
                {
                    var indicator = new HpBarIndicator { Unit = hero };

                    X = (int) indicator.Position.X;
                    Y = (int) indicator.Position.Y;

                    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 = new ColorBGRA(255, 255, 255, 255);
                            Text.OnEndScene();
                        }

                        texture.X = X + 3;
                        texture.Y = Y + 1 + 13 * k;
                        texture.Crop(new Rectangle(0, 12 * n, 12, 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 = new ColorBGRA(255, 255, 255, 255);
                            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) 12)
                        {
                            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);
            }
        }
Exemplo n.º 4
0
        public static void OnDraw(EventArgs args)
        {
            if (!Config.Item("enabledrawings").GetValue<bool>())
            {
                return;
            }

         
            foreach (Info info in Ranks)
            {
              //  System.IO.File.WriteAllText(@"C:\Users\Laptop\Desktop\" + info.Name + ".txt", info.Ranking);
                if ((!info.herohandle.IsDead) && (info.herohandle.IsVisible))
                {
                    // var wts = Drawing.WorldToScreen(info.herohandle.Position);
                    var indicator = new HpBarIndicator { Unit = info.herohandle };
                    int Xee = (int) indicator.Position.X + 90;
                    int Yee = (int) indicator.Position.Y + 5;
                    var font = new Font("Calibri", 13.5F);

                    if (Config.Item("enabledebug").GetValue<bool>())
                    {
                          //  Console.WriteLine("Drawing: " + info.Name);
                            Drawing.DrawText(Xee - (TextWidth(info.Ranking, font)/2), Yee - 60, Color.Yellow,
                                info.Ranking);
                    }

                    if (info.kdaratio != null && Config.Item("enablekdaratio").GetValue<bool>())
                    {
                        if (info.kdaratio.Contains("KDA")) //checking if its valid
                        {
                            Drawing.DrawText(Xee - (TextWidth(info.kdaratio, font)/2), Yee - 50, info.kdaratiocolor,
                                info.kdaratio);
                            Yee = Yee - 20;
                        }
                    }
                    if (info.winratio != null && Config.Item("enablewinratio").GetValue<bool>())
                    {
                        if (info.winratio.Contains("Win Ratio")) //checking if its valid
                        {
                            Drawing.DrawText(Xee - (TextWidth(info.winratio, font)/2), Yee - 50, info.winratiocolor,
                                info.winratio);
                            Yee = Yee - 20;
                        }
                    }

                    // Drawing.DrawText(wts.X, wts.Y, Color.Brown, "x");
                    // Unneccesary at the moment
                    if (Config.Item("enablerank").GetValue<bool>())
                    {
                        if (info.Ranking.ToLower().Contains("not found") && Config.Item("showunknown").GetValue<bool>())
                        {
                            Drawing.DrawText(Xee - (TextWidth(info.Ranking, font)/2), Yee - 50, Color.Yellow,
                                info.Ranking);
                        }
                        if (info.Ranking.ToLower().Contains("unknown") && Config.Item("showunknown").GetValue<bool>())
                        {
                            Drawing.DrawText(Xee - (TextWidth("Unknown)", font)/2), Yee - 50, Color.Yellow, "Unknown");
                        }
                        if (info.Ranking.Contains("Unranked (L-30)") && Config.Item("showunknown").GetValue<bool>())
                        {
                            Drawing.DrawText(Xee - (TextWidth("Unranked (L-30)", font)/2), Yee - 50, Color.Yellow,
                                "Unranked (L-30)");
                        }
                        if (info.Ranking.ToLower().Contains("error") && Config.Item("showunknown").GetValue<bool>())
                        {
                            Drawing.DrawText(Xee - (TextWidth(info.Ranking, font)/2), Yee - 50, Color.Red, info.Ranking);
                        }
                        if (info.Ranking.ToLower().Equals("unranked"))
                        {
                            Drawing.DrawText(Xee - (TextWidth(info.Ranking, font)/2), Yee - 50, Color.White, "Unranked");
                        }
                        if (info.Ranking.ToLower().Contains("bronze") || info.Ranking.ToLower().Contains("silver") ||
                            info.Ranking.ToLower().Contains("gold") || info.Ranking.ToLower().Contains("platinum") ||
                            info.Ranking.ToLower().Contains("diamond") || info.Ranking.ToLower().Contains("master") ||
                            info.Ranking.ToLower().Contains("challenger"))
                        {
                            Drawing.DrawText(Xee - (TextWidth(info.Ranking + " (" + info.lpamount + ")", font)/2),
                                Yee - 50, rankincolor(info.Ranking), info.Ranking + " (" + info.lpamount + ")");
                        }
                        //else { Game.PrintChat }
                    }
                }
            }
        }