public static void Game_OnGameLoad() { 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.OnPresent += Drawing_OnEndScene; Drawing.OnPreReset += DrawingOnOnPreReset; Drawing.OnPostReset += DrawingOnOnPostReset; // Drawing.OnDraw += Drawing_OnEndScene; AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload; AppDomain.CurrentDomain.ProcessExit += CurrentDomain_DomainUnload; }
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; }
public ChampionInfo(Obj_AI_Hero 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.ClockTime - _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.ClockTime - _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.ClockTime - _lineStart < Program.Instance().LineDuration; } }; minimapLine.Add(0); Game.OnUpdate += Game_OnGameUpdate; OnEnterRange += ChampionInfo_OnEnterRange; }
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; }
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); } }
public InternalGankTracker(Render.Line line) { Line = line; }
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); } } }; for (int i = 0; i < _summonerSpellSlots.Length; i++) { var index = i; var spell = Hero.SummonerSpellbook.GetSpell(_spellSlots[index]); 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, 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); } }
public InternalGankDetector(Render.Text text, Render.Line line) { Text = text; Line = line; }
private void Init() { foreach (Obj_AI_Hero hero in ObjectManager.Get<Obj_AI_Hero>()) { 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 { if (hero.IsEnemy) { Speech.Speak(Language.GetString("DETECTORS_GANK_TEXT_JUNGLER_ENEMY")); } 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(); if (hero.IsEnemy) { Enemies.Add(hero, new InternalGankDetector(text, line)); } } }
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)); } } }
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; } ColorBGRA newCol = Common.PercentColorRedToGreen(percent, (int)(255 - (255 * 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; }; 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 { Color newCol = new 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; }; Line.Add(); 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 { Color newCol = new Color(255, 255, 255, (int)(255 - (150 * RecallStatusPercent()))); if (!Equals(newCol, Text.Color)) { Text.Color = newCol; } TimeSpan t = TimeSpan.FromMilliseconds(Recall.Start + Recall.Duration - Environment.TickCount); string time = string.Format("{0:D2},{1:D3}", t.Seconds, t.Milliseconds); return ObjectManager.GetUnitByNetworkId<Obj_AI_Hero>(Recall.UnitNetworkId).ChampionName + "\n" + time; }; Text.Centered = true; Text.VisibleCondition = delegate { return IsActive() && Recall.Status == Packet.S2C.Teleport.Status.Start; }; Text.Add(); }