Пример #1
0
 public Gank()
 {
     foreach (Obj_AI_Hero hero in ObjectManager.Get <Obj_AI_Hero>())
     {
         if (hero.IsEnemy)
         {
             Render.Line         line = new Render.Line(new Vector2(0, 0), new Vector2(0, 0), 2, Color.LightGreen);
             InternalGankTracker gank = new InternalGankTracker(line);
             line.StartPositionUpdate = delegate
             {
                 return(Drawing.WorldToScreen(ObjectManager.Player.Position));
             };
             line.EndPositionUpdate = delegate
             {
                 return(Drawing.WorldToScreen(hero.Position));
             };
             line.VisibleCondition = delegate
             {
                 return(Tracker.Trackers.GetActive() && GankTracker.GetActive() &&
                        GankTracker.GetMenuItem("SAssembliesTrackersGankDraw").GetValue <bool>() &&
                        hero.ServerPosition.Distance(ObjectManager.Player.ServerPosition) <
                        GankTracker.GetMenuItem("SAssembliesTrackersGankTrackRange").GetValue <Slider>().Value&&
                        hero.IsVisible && !hero.IsDead &&
                        (GankTracker.GetMenuItem("SAssembliesTrackersGankKillable").GetValue <bool>() && gank.Damage > hero.Health ||
                         !GankTracker.GetMenuItem("SAssembliesTrackersGankKillable").GetValue <bool>()));
             };
             line.Add();
             _enemies.Add(hero, gank);
         }
     }
     ThreadHelper.GetInstance().Called += Game_OnGameUpdate;
     //Game.OnGameUpdate += Game_OnGameUpdate;
 }
Пример #2
0
        public static void Game_OnGameLoad()
        {
            try
            {
                foreach (var sName in
                         SummonersNames)
                {
                    SummonerTextures.Add(sName, GetSummonerTexture(sName));
                }

                CdFrame   = new Render.Sprite(Resources.hudTRACKER, Vector2.Zero);
                ReadyLine = new Render.Line(Vector2.Zero, Vector2.Zero, 2, Color.Black);
                Text      = new Render.Text("", Vector2.Zero, 13, Color.Black);
            }
            catch (Exception e)
            {
                Console.WriteLine(@"/ff can't load the textures: " + e);
            }
            Drawing.OnPresent   += Drawing_OnEndScene;
            Drawing.OnPreReset  += DrawingOnOnPreReset;
            Drawing.OnPostReset += DrawingOnOnPostReset;
            //       Drawing.OnDraw += Drawing_OnEndScene;
            AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload;
            AppDomain.CurrentDomain.ProcessExit  += CurrentDomain_DomainUnload;
        }
Пример #3
0
        private void Init()
        {
            foreach (Obj_AI_Hero hero in ObjectManager.Get <Obj_AI_Hero>())
            {
                if (!hero.IsEnemy)
                {
                    continue;
                }
                bool hasSmite = false;
                foreach (SpellDataInst spell in hero.Spellbook.Spells)
                {
                    if (spell.Slot.HasFlag(SpellSlot.Summoner1 | SpellSlot.Summoner2))
                    {
                        if (spell.Name.ToLower().Contains("smite"))
                        {
                            hasSmite = true;
                            break;
                        }
                    }
                }
                if (hasSmite)
                {
                    Render.Text text = new Render.Text(new Vector2(0, 0), hero.IsEnemy ? Language.GetString("DETECTORS_GANK_TEXT_JUNGLER_ENEMY") :
                                                       Language.GetString("DETECTORS_GANK_TEXT_JUNGLER_ALLY"), 28, hero.IsEnemy ? Color.Red : Color.Green);
                    text.PositionUpdate = delegate
                    {
                        return(Drawing.WorldToScreen(ObjectManager.Player.ServerPosition));
                    };
                    text.VisibleCondition = sender =>
                    {
                        return(IsVisible(hero));
                    };
                    text.OutLined = true;
                    text.Centered = true;
                    text.Add();
                    Render.Line line = new Render.Line(new Vector2(1, 1), new Vector2(1, 1), 4, hero.IsEnemy ? Color.Red : Color.Green);
                    line.StartPositionUpdate = delegate
                    {
                        return(Drawing.WorldToScreen(ObjectManager.Player.ServerPosition));
                    };
                    line.EndPositionUpdate = delegate
                    {
                        return(Drawing.WorldToScreen(hero.ServerPosition));
                    };
                    line.VisibleCondition = sender =>
                    {
                        return(IsVisible(hero));
                    };
                    line.Add();

                    Enemies.Add(hero, new InternalGankDetector(text, line));
                }
                else
                {
                    Enemies.Add(hero, new InternalGankDetector(null, null));
                }
            }
        }
Пример #4
0
 public ChampionInfo(Obj_AI_Hero hero)
 {
     _hero = hero;
     Render.Line line = new Render.Line(new Vector2(), new Vector2(), 5,
                                        new Color {
         R = 255, G = 0, B = 0, A = 125
     })
     {
         StartPositionUpdate = () => Drawing.WorldToScreen(ObjectManager.Player.Position),
         EndPositionUpdate   = () => Drawing.WorldToScreen(_hero.Position),
         VisibleCondition    =
             delegate
         {
             return(!_hero.IsDead &&
                    Game.ClockTime - _lineStart < Program.Instance().LineDuration);
         }
     };
     line.Add(0);
     Game.OnGameUpdate += Game_OnGameUpdate;
     OnEnterRange      += ChampionInfo_OnEnterRange;
 }
Пример #5
0
        static HbTracker()
        {
            try
            {
                foreach (var sName in
                         SummonersNames)
                {
                    SummonerTextures.Add(sName, GetSummonerTexture(sName));
                }

                CdFrame   = new Render.Sprite(Resources.hud, Vector2.Zero);
                ReadyLine = new Render.Line(Vector2.Zero, Vector2.Zero, 2, Color.Black);
                Text      = new Render.Text("", Vector2.Zero, 13, Color.Black);
            }
            catch (Exception e)
            {
                Console.WriteLine(@"/ff can't load the textures: " + e);
            }

            Drawing.OnDraw += Drawing_OnEndScene;
        }
Пример #6
0
        static HbTracker()
        {
            try
            {
                foreach (var sName in
                         SummonersNames.Where(
                             s => HeroManager.AllHeroes.Any(h => !h.GetSpellSlot(s).Equals(SpellSlot.Unknown))))
                {
                    SummonerTextures.Add(sName, GetSummonerTexture(sName));
                }

                CdFrame   = new Render.Sprite(CurrentHud, Vector2.Zero);
                ReadyLine = new Render.Line(Vector2.Zero, Vector2.Zero, 2, Color.Black);
                Text      = new Render.Text("", Vector2.Zero, 13, Color.Black);
            }
            catch (Exception e)
            {
                Console.WriteLine(@"/ff can't load the textures: " + e);
            }

            Drawing.OnDraw += Drawing_OnEndScene;
        }
Пример #7
0
 public GankPotentialTracker()
 {
     foreach (Obj_AI_Hero hero in ObjectManager.Get <Obj_AI_Hero>())
     {
         if (hero.IsEnemy)
         {
             Render.Line line = new Render.Line(new Vector2(0, 0), new Vector2(0, 0), 2, Color.LightGreen);
             line.StartPositionUpdate = delegate
             {
                 return(Drawing.WorldToScreen(ObjectManager.Player.Position));
             };
             line.EndPositionUpdate = delegate
             {
                 return(Drawing.WorldToScreen(hero.Position));
             };
             line.VisibleCondition = delegate
             {
                 return(Menu.GankTracker.GetMenuItem("SAwarenessGankTrackerDraw").GetValue <bool>());
             };
             _enemies.Add(hero, new InternalGankTracker(line));
         }
     }
     Game.OnGameUpdate += Game_OnGameUpdate;
 }
Пример #8
0
            public Cooldown(Obj_AI_Hero hero)
            {
                Hero       = hero;
                _hudSprite =
                    new Render.Sprite(Resources.CD_Hud, default(Vector2))
                {
                    VisibleCondition = delegate
                    {
                        try
                        {
                            return(Visible);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                            return(false);
                        }
                    },
                    PositionUpdate = delegate
                    {
                        try
                        {
                            return(HpBarPostion);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                            return(default(Vector2));
                        }
                    }
                };

                //  Game.PrintChat(_summonerSpellSlots.Length.ToString());
                for (int i = 0; i < _summonerSpellSlots.Length; i++)
                {
                    // foreach (var sSlot in _summonerSpellSlots) {
                    //for (int i = 0; i < _summonerSpellSlots.Length; i++)
                    var index = i;
                    var spell = Hero.Spellbook.GetSpell(_summonerSpellSlots[index]);
                    // Game.PrintChat(spell.Name);
                    var summoner = Resources.ResourceManager.GetObject(string.Format("CD_{0}", spell.Name.ToLower())) ??
                                   Resources.CD_summonerbarrier;
                    var sprite = new Render.Sprite((Bitmap)summoner, default(Vector2))
                    {
                        VisibleCondition = delegate
                        {
                            try
                            {
                                return(Visible);
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.ToString());
                                return(false);
                            }
                        }
                    };
                    sprite.PositionUpdate = delegate
                    {
                        try
                        {
                            sprite.Crop(new Rectangle(0,
                                                      12 *
                                                      ((spell.CooldownExpires - Game.Time > 0)
                                    ? (int)
                                                       (19 *
                                                        (1f -
                                                         ((Math.Abs(spell.Cooldown) > float.Epsilon)
                                              ? (spell.CooldownExpires - Game.Time) / spell.Cooldown
                                              : 1f)))
                                    : 19), 12, 12));
                            return(new Vector2(HpBarPostion.X + 3, HpBarPostion.Y + 1 + index * 13));
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                            return(default(Vector2));
                        }
                    };
                    var text = new Render.Text(default(Vector2), string.Empty, index * 13, Color.White)
                    {
                        VisibleCondition = delegate
                        {
                            try
                            {
                                return(Visible);
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.ToString());
                                return(false);
                            }
                        }
                    };
                    text.PositionUpdate =
                        delegate
                    {
                        try
                        {
                            return(new Vector2(HpBarPostion.X - 5 - text.text.Length * 5,
                                               HpBarPostion.Y + 1 + 13 * index));
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                            return(default(Vector2));
                        }
                    };
                    text.TextUpdate = delegate
                    {
                        try
                        {
                            return(spell.CooldownExpires - Game.Time > 0f
                                ? string.Format(spell.CooldownExpires - Game.Time < 1f ? "{0:0.0}" : "{0:0}",
                                                spell.CooldownExpires - Game.Time)
                                : string.Empty);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                            return(string.Empty);
                        }
                    };
                    _summonerSprites.Add(sprite);
                    _summonerSpellTexts.Add(text);
                }

                for (int i = 0; i < _spellSlots.Length; i++)
                {
                    var index = i;
                    var spell = Hero.Spellbook.GetSpell(_spellSlots[index]);
                    var line  = new Render.Line(default(Vector2), default(Vector2), 4, Color.Green)
                    {
                        VisibleCondition = delegate
                        {
                            try
                            {
                                return(Visible &&
                                       Hero.Spellbook.CanUseSpell(_spellSlots[index]) != SpellState.NotLearned);
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.ToString());
                                return(false);
                            }
                        },
                        StartPositionUpdate = delegate
                        {
                            try
                            {
                                return(new Vector2(HpBarPostion.X + 18f + index * 27f, HpBarPostion.Y + 20f));
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.ToString());
                                return(default(Vector2));
                            }
                        }
                    };
                    line.EndPositionUpdate =
                        delegate
                    {
                        try
                        {
                            line.Color = spell.CooldownExpires - Game.Time <= 0f ? Color.Green : Color.DeepSkyBlue;
                            return
                                (new Vector2(
                                     line.Start.X +
                                     ((spell.CooldownExpires - Game.Time > 0f &&
                                       Math.Abs(spell.Cooldown) > float.Epsilon)
                                            ? 1f - ((spell.CooldownExpires - Game.Time) / spell.Cooldown)
                                            : 1f) * 23f, line.Start.Y));
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                            return(default(Vector2));
                        }
                    };
                    var text = new Render.Text(default(Vector2), string.Empty, 13, Color.White)
                    {
                        VisibleCondition = delegate
                        {
                            try
                            {
                                return(Visible);
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.ToString());
                                return(false);
                            }
                        }
                    };
                    text.PositionUpdate =
                        delegate
                    {
                        try
                        {
                            return(new Vector2(line.Start.X + (23f - text.text.Length * 4) / 2, line.Start.Y + 7f));
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                            return(default(Vector2));
                        }
                    };
                    text.TextUpdate = delegate
                    {
                        try
                        {
                            return(spell.CooldownExpires - Game.Time > 0f
                                ? string.Format(spell.CooldownExpires - Game.Time < 1f ? "{0:0.0}" : "{0:0}",
                                                spell.CooldownExpires - Game.Time)
                                : string.Empty);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.ToString());
                            return(string.Empty);
                        }
                    };
                    _spellLines.Add(line);
                    _spellTexts.Add(text);
                }
            }
Пример #9
0
        public void CreateRenderObjects()
        {
            //Create the minimap sprite.

            if (Range == 1100)
            {
                _minimapSprite       = new Render.Sprite(WardData.Bitmap, MinimapPosition);
                _minimapSprite.Scale = new Vector2(_scale, _scale);
                _minimapSprite.Add(0);
            }

            //Create the circle:
            _defaultCircle = new Render.Circle(Position, 200, Color, 5, true);
            _defaultCircle.VisibleCondition +=
                sender =>
                WardTracker.Config.Item("Enabled").GetValue <bool>() &&
                !WardTracker.Config.Item("Details").GetValue <KeyBind>().Active&&
                Render.OnScreen(Drawing.WorldToScreen(Position));
            _defaultCircle.Add(0);
            _defaultCircleFilled = new Render.Circle(Position, 200, Color.FromArgb(25, Color), -142857, true);
            _defaultCircleFilled.VisibleCondition +=
                sender =>
                WardTracker.Config.Item("Enabled").GetValue <bool>() &&
                !WardTracker.Config.Item("Details").GetValue <KeyBind>().Active&&
                Render.OnScreen(Drawing.WorldToScreen(Position));
            _defaultCircleFilled.Add(-1);

            //Create the circle that shows the range
            _rangeCircle = new Render.Circle(Position, Range, Color, 10, false);
            _rangeCircle.VisibleCondition +=
                sender =>
                WardTracker.Config.Item("Enabled").GetValue <bool>() &&
                WardTracker.Config.Item("Details").GetValue <KeyBind>().Active;
            _rangeCircle.Add(0);

            _rangeCircleFilled = new Render.Circle(Position, Range, Color.FromArgb(25, Color), -142857, true);
            _rangeCircleFilled.VisibleCondition +=
                sender =>
                WardTracker.Config.Item("Enabled").GetValue <bool>() &&
                WardTracker.Config.Item("Details").GetValue <KeyBind>().Active;
            _rangeCircleFilled.Add(-1);


            //Missile line;
            if (IsFromMissile)
            {
                _missileLine = new Render.Line(new Vector2(), new Vector2(), 2, new ColorBGRA(255, 255, 255, 255));
                _missileLine.EndPositionUpdate   = () => Drawing.WorldToScreen(Position);
                _missileLine.StartPositionUpdate = () => Drawing.WorldToScreen(StartPosition);
                _missileLine.VisibleCondition   +=
                    sender =>
                    WardTracker.Config.Item("Enabled").GetValue <bool>() &&
                    WardTracker.Config.Item("Details").GetValue <KeyBind>().Active;
                _missileLine.Add(0);
            }


            //Create the timer text:
            if (Duration != int.MaxValue)
            {
                _timerText                   = new Render.Text(10, 10, "t", 18, new ColorBGRA(255, 255, 255, 255));
                _timerText.OutLined          = true;
                _timerText.PositionUpdate    = () => Drawing.WorldToScreen(Position);
                _timerText.Centered          = true;
                _timerText.VisibleCondition +=
                    sender =>
                    WardTracker.Config.Item("Enabled").GetValue <bool>() &&
                    Render.OnScreen(Drawing.WorldToScreen(Position));

                _timerText.TextUpdate =
                    () =>
                    (IsFromMissile ? "?? " : "") + Utils.FormatTime((EndT - Environment.TickCount) / 1000f) +
                    (IsFromMissile ? " ??" : "");
                _timerText.Add(2);
            }
        }
Пример #10
0
        public ChampionInfo(AIHeroClient hero, bool ally)
        {
            index++;
            int textoffset = index * 50;

            _hero = hero;
            Render.Text text = new Render.Text(
                new Vector2(), _hero.ChampionName, 20,
                ally
                    ? new Color {
                R = 205, G = 255, B = 205, A = 255
            }
                    : new Color {
                R = 255, G = 205, B = 205, A = 255
            })
            {
                PositionUpdate =
                    () =>
                    Drawing.WorldToScreen(
                        ObjectManager.Player.Position.Extend(_hero.Position, 300 + textoffset)),
                VisibleCondition = delegate
                {
                    float dist = _hero.Distance(ObjectManager.Player.Position);
                    return(Program.Instance().ShowChampionNames&& !_hero.IsDead &&
                           Game.Time - _lineStart < Program.Instance().LineDuration&&
                           (!_hero.IsVisible || !Render.OnScreen(Drawing.WorldToScreen(_hero.Position))) &&
                           dist < Program.Instance().Radius&& dist > 300 + textoffset);
                },
                Centered = true,
                OutLined = true,
            };
            text.Add(1);
            _line = new Render.Line(
                new Vector2(), new Vector2(), 5,
                ally ? new Color {
                R = 0, G = 255, B = 0, A = 125
            } : new Color {
                R = 255, G = 0, B = 0, A = 125
            })
            {
                StartPositionUpdate = () => Drawing.WorldToScreen(ObjectManager.Player.Position),
                EndPositionUpdate   = () => Drawing.WorldToScreen(_hero.Position),
                VisibleCondition    =
                    delegate
                {
                    return(!_hero.IsDead && Game.Time - _lineStart < Program.Instance().LineDuration&&
                           _hero.Distance(ObjectManager.Player.Position) < (Program.Instance().Radius + 1000));
                }
            };
            _line.Add(0);
            Render.Line minimapLine = new Render.Line(
                new Vector2(), new Vector2(), 2,
                ally ? new Color {
                R = 0, G = 255, B = 0, A = 255
            } : new Color {
                R = 255, G = 0, B = 0, A = 255
            })
            {
                StartPositionUpdate = () => Drawing.WorldToMinimap(ObjectManager.Player.Position),
                EndPositionUpdate   = () => Drawing.WorldToMinimap(_hero.Position),
                VisibleCondition    =
                    delegate
                {
                    return(Program.Instance().DrawMinimapLines&& !_hero.IsDead && Game.Time - _lineStart < Program.Instance().LineDuration);
                }
            };
            minimapLine.Add(0);
            Game.OnUpdate += Game_OnGameUpdate;
            OnEnterRange  += ChampionInfo_OnEnterRange;
        }
Пример #11
0
 public InternalGankTracker(Render.Line line)
 {
     Line = line;
 }
Пример #12
0
 public InternalGankDetector(Render.Text text, Render.Line line)
 {
     Text = text;
     Line = line;
 }
Пример #13
0
            public RecallRender(Packet.S2C.Teleport.Struct recall)
            {
                var recWidth = 200;

                Recall    = recall;
                Rectangle = new Render.Rectangle(Drawing.Width / 2, Drawing.Height / 4, recWidth, 10, SharpDX.Color.Green);
                Rectangle.PositionUpdate += delegate
                {
                    float percent  = RecallStatusPercent();
                    var   newWidth = (int)(recWidth - (recWidth * percent));
                    if (!Rectangle.Width.Equals(newWidth))
                    {
                        Rectangle.Width = newWidth;
                    }
                    SharpDX.Color newCol = Common.PercentColorRedToGreen(percent);
                    if (!Equals(newCol, Rectangle.Color))
                    {
                        Rectangle.Color = newCol;
                    }
                    return(new Vector2(Drawing.Width / 2 - recWidth / 2, Drawing.Height / 1.5f));
                };
                Rectangle.VisibleCondition = delegate
                {
                    return(IsActive() && Recall.Status == Packet.S2C.Teleport.Status.Start && (Recall.Start + Recall.Duration - Environment.TickCount) > 0);
                };
                Rectangle.Add(1);
                Line = new Render.Line(new Vector2(0, 0), new Vector2(0, 0), 1, SharpDX.Color.WhiteSmoke);
                Line.StartPositionUpdate += delegate
                {
                    return(new Vector2(Rectangle.X + Rectangle.Width, Rectangle.Y - 5));
                };
                Line.EndPositionUpdate += delegate
                {
                    return(new Vector2(Rectangle.X + Rectangle.Width, Rectangle.Y));
                };
                Line.VisibleCondition = delegate
                {
                    SharpDX.Color newCol = new SharpDX.Color(255, 255, 255, (int)(255 - (255 * RecallStatusPercent())));
                    if (!Equals(newCol, Line.Color))
                    {
                        Line.Color = newCol;
                    }
                    return(IsActive() && Recall.Status == Packet.S2C.Teleport.Status.Start && (Recall.Start + Recall.Duration - Environment.TickCount) > 0);
                };
                Line.Add(1);
                Text = new Render.Text(ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(Recall.UnitNetworkId).ChampionName, 0, 0, 18, SharpDX.Color.WhiteSmoke);
                Text.PositionUpdate += delegate
                {
                    return(new Vector2(Line.Start.X, Line.Start.Y - 15));
                };
                Text.TextUpdate = delegate
                {
                    SharpDX.Color newCol = new SharpDX.Color(255, 255, 255, (int)(255 - (150 * RecallStatusPercent())));
                    if (!Equals(newCol, Text.Color))
                    {
                        Text.Color = newCol;
                    }
                    return(ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(Recall.UnitNetworkId).ChampionName);
                };
                Text.Centered         = true;
                Text.VisibleCondition = delegate
                {
                    return(IsActive() && Recall.Status == Packet.S2C.Teleport.Status.Start && (Recall.Start + Recall.Duration - Environment.TickCount) > 0);
                };
                Text.Add(1);
                Text2 = new Render.Text(ObjectManager.GetUnitByNetworkId <Obj_AI_Hero>(Recall.UnitNetworkId).ChampionName, 0, 0, 18, SharpDX.Color.WhiteSmoke);
                Text2.PositionUpdate += delegate
                {
                    return(new Vector2(Line.Start.X, Line.Start.Y - 5));
                };
                Text2.TextUpdate = delegate
                {
                    SharpDX.Color newCol = new SharpDX.Color(255, 255, 255, (int)(255 - (150 * RecallStatusPercent())));
                    if (!Equals(newCol, Text2.Color))
                    {
                        Text2.Color = newCol;
                    }
                    TimeSpan t = TimeSpan.FromMilliseconds(Recall.Start + Recall.Duration - Environment.TickCount);
                    return(string.Format("{0}.{1}", t.Seconds, t.Milliseconds.ToString("D3").Remove(1, 2)));
                };
                Text2.Centered         = true;
                Text2.VisibleCondition = delegate
                {
                    return(IsActive() && Recall.Status == Packet.S2C.Teleport.Status.Start && (Recall.Start + Recall.Duration - Environment.TickCount) > 0);
                };
                Text2.Add(1);
            }