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(); }
/// <summary> /// Loads the sprites. /// </summary> private static void LoadSprites() { foreach (var player in ObjectManager.Get<Obj_AI_Hero>().Where(h => !h.IsMe)) { try { var player_Ex = player; var Summoner1Bitmap = TrackerVariables.summonerSpells[player_Ex.Spellbook.GetSpell(SpellSlot.Summoner1).Name.ToLower()]; var Summoner2Bitmap = TrackerVariables.summonerSpells[player_Ex.Spellbook.GetSpell(SpellSlot.Summoner2).Name.ToLower()]; Render.Sprite SummonerSpell1 = new Render.Sprite(Resources.empty, new Vector2()); Render.Sprite SummonerSpell2 = new Render.Sprite(Resources.empty, new Vector2()); var member = new TrackerWrapper(); var scale = 0.94f; var offset = 8 * scale; var offsetX = 0; var Hudsprite = new Render.Sprite(TrackerVariables.TrackerHud, new Vector2(0, 0)) { PositionUpdate = () => new Vector2(player_Ex.HPBarPosition.X - 14 * scale, player_Ex.HPBarPosition.Y + offset + 6 * scale), VisibleCondition = sender => player_Ex.IsHPBarRendered && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)), Scale = new Vector2(1.0f, 1.0f) }; try { Hudsprite.Add(0); } catch (Exception e) { Console.WriteLine(e); } #region Summoner Spells if (Summoner1Bitmap != null) { SummonerSpell1 = new Render.Sprite(Summoner1Bitmap, new Vector2(0, 0)) { PositionUpdate = () => new Vector2(player_Ex.HPBarPosition.X - 8 * scale, player_Ex.HPBarPosition.Y + offset + 8 * scale), VisibleCondition = sender => player_Ex.IsHPBarRendered && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)), Scale = new Vector2(1.0f, 1.0f) }; SummonerSpell1.Add(0); member.Summoner1 = SummonerSpell1; var Summoner1Rectangle = new Render.Rectangle((int)player_Ex.HPBarPosition.X - 7, (int)player_Ex.HPBarPosition.Y + 8, 13, 13, new ColorBGRA(0, 0, 0, 175)) { VisibleCondition = sender => player_Ex.IsHPBarRendered && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)), PositionUpdate = () => new Vector2((int)player_Ex.HPBarPosition.X - 7 * scale, (int)player_Ex.HPBarPosition.Y + offset + 8 * scale), }; Summoner1Rectangle.Add(0); member.SummonerSpell1Rectangle = Summoner1Rectangle; var spellCooldown = player_Ex.Spellbook.GetSpell(SpellSlot.Summoner1).CooldownExpires - Game.Time; var Summoner1Text = new Render.Text((int)player_Ex.HPBarPosition.X - 31, (int)player_Ex.HPBarPosition.Y + 6, ((int)spellCooldown).ToString(), 14, new ColorBGRA(255, 255, 255, 255)) { TextUpdate = () => ((int)(player_Ex.Spellbook.GetSpell(SpellSlot.Summoner1).CooldownExpires - Game.Time) > 0 ? ((int)(player_Ex.Spellbook.GetSpell(SpellSlot.Summoner1).CooldownExpires - Game.Time)).ToString() : string.Empty), PositionUpdate = () => new Vector2((int)player_Ex.HPBarPosition.X - 31 * scale, (int)player_Ex.HPBarPosition.Y + offset + 6 * scale), VisibleCondition = sender => MenuExtensions.GetItemValue<bool>("dz191.dza.tracker.track.cd") && player_Ex.IsHPBarRendered && (player_Ex.Spellbook.GetSpell(SpellSlot.Summoner1).CooldownExpires - Game.Time) > 0 && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)) }; Summoner1Text.Add(0); member.SummonerSpell1Text = Summoner1Text; } if (Summoner2Bitmap != null) { SummonerSpell2 = new Render.Sprite(Summoner2Bitmap, new Vector2(0, 0)) { PositionUpdate = () => new Vector2(player_Ex.HPBarPosition.X - 8 * scale, player_Ex.HPBarPosition.Y + offset + 25 * scale), VisibleCondition = sender => player_Ex.IsHPBarRendered && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)), Scale = new Vector2(1.0f, 1.0f) }; SummonerSpell2.Add(0); member.Summoner2 = SummonerSpell2; var Summoner2Rectangle = new Render.Rectangle((int)player_Ex.HPBarPosition.X - 7, (int)player_Ex.HPBarPosition.Y + 26, 13, 13, new ColorBGRA(0, 0, 0, 175)) { VisibleCondition = sender => player_Ex.IsHPBarRendered && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)), PositionUpdate = () => new Vector2((int)player_Ex.HPBarPosition.X - 7 * scale, (int)player_Ex.HPBarPosition.Y + offset + 26 * scale), }; Summoner2Rectangle.Add(0); var spellCooldown = player_Ex.Spellbook.GetSpell(SpellSlot.Summoner2).CooldownExpires - Game.Time; var Summoner2Text = new Render.Text((int)player_Ex.HPBarPosition.X - 31, (int)player_Ex.HPBarPosition.Y + 24, ((int)spellCooldown).ToString(), 14, new ColorBGRA(255, 255, 255, 255)) { TextUpdate = () => ((int)(player_Ex.Spellbook.GetSpell(SpellSlot.Summoner2).CooldownExpires - Game.Time) > 0 ? ((int)(player_Ex.Spellbook.GetSpell(SpellSlot.Summoner2).CooldownExpires - Game.Time)).ToString() : string.Empty), PositionUpdate = () => new Vector2((int)player_Ex.HPBarPosition.X - 31 * scale, (int)player_Ex.HPBarPosition.Y + offset + 24 * scale), VisibleCondition = sender => MenuExtensions.GetItemValue<bool>("dz191.dza.tracker.track.cd") && player_Ex.IsHPBarRendered && (player_Ex.Spellbook.GetSpell(SpellSlot.Summoner2).CooldownExpires - Game.Time) > 0 && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)) }; Summoner2Text.Add(0); member.SummonerSpell2Text = Summoner2Text; member.SummonerSpell2Rectangle = Summoner2Rectangle; } #endregion #region Normal Spells #region Spell1 var slot1 = SpellSlot.Q; var Spell1Rectangle = new Render.Sprite(Resources.CooldownSprite, new Vector2((int)player_Ex.HPBarPosition.X + 13, (int)player_Ex.HPBarPosition.Y + 30)) { VisibleCondition = sender => player_Ex.IsHPBarRendered && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)), PositionUpdate = () => new Vector2(player_Ex.HPBarPosition.X + offsetX + 13.2f * scale, (int)player_Ex.HPBarPosition.Y + offset + 28 * scale), }; member.Spell1Rectangle = Spell1Rectangle; Spell1Rectangle.Add(0); var Spell1Text = new Render.Text((int)player_Ex.HPBarPosition.X + 16, (int)player_Ex.HPBarPosition.Y + 33, string.Empty, 14, new ColorBGRA(255, 255, 255, 255)) { TextUpdate = () => ((player_Ex.Spellbook.GetSpell(slot1).CooldownExpires - Game.Time) > 0 ? (Truncate((player_Ex.Spellbook.GetSpell(slot1).CooldownExpires - Game.Time))) : string.Empty), PositionUpdate = () => new Vector2((int)player_Ex.HPBarPosition.X + offsetX + 16 * scale, (int)player_Ex.HPBarPosition.Y + offset + 33 * scale), VisibleCondition = sender => MenuExtensions.GetItemValue<bool>("dz191.dza.tracker.track.cd") && player_Ex.IsHPBarRendered && (player_Ex.Spellbook.GetSpell(slot1).CooldownExpires - Game.Time) > 0 && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)) }; member.Spell1Text = Spell1Text; Spell1Text.Add(0); #endregion #region Spell2 var slot2 = SpellSlot.W; var Spell2Rectangle = new Render.Sprite(Resources.CooldownSprite, new Vector2((int)player_Ex.HPBarPosition.X + 41, (int)player_Ex.HPBarPosition.Y + 30)) { VisibleCondition = sender => player_Ex.IsHPBarRendered && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)), PositionUpdate = () => new Vector2(player_Ex.HPBarPosition.X + offsetX + 41f * scale, (int)player_Ex.HPBarPosition.Y + offset + 28 * scale), }; member.Spell2Rectangle = Spell2Rectangle; Spell2Rectangle.Add(0); var Spell2Text = new Render.Text((int)player_Ex.HPBarPosition.X + 44, (int)player_Ex.HPBarPosition.Y + 33, string.Empty, 14, new ColorBGRA(255, 255, 255, 255)) { TextUpdate = () => ((player_Ex.Spellbook.GetSpell(slot2).CooldownExpires - Game.Time) > 0 ? (Truncate((player_Ex.Spellbook.GetSpell(slot2).CooldownExpires - Game.Time))) : string.Empty), PositionUpdate = () => new Vector2((int)player_Ex.HPBarPosition.X + offsetX + 43.8f * scale, (int)player_Ex.HPBarPosition.Y + offset + 33 * scale), VisibleCondition = sender => MenuExtensions.GetItemValue<bool>("dz191.dza.tracker.track.cd") && player_Ex.IsHPBarRendered && (player_Ex.Spellbook.GetSpell(slot2).CooldownExpires - Game.Time) > 0 && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)) }; member.Spell2Text = Spell2Text; Spell2Text.Add(0); #endregion #region Spell3 var slot3 = SpellSlot.E; var Spell3Rectangle = new Render.Sprite(Resources.CooldownSprite, new Vector2((int)player_Ex.HPBarPosition.X + 41, (int)player_Ex.HPBarPosition.Y + 30)) { VisibleCondition = sender => player_Ex.IsHPBarRendered && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)), PositionUpdate = () => new Vector2(player_Ex.HPBarPosition.X + offsetX + 69f * scale, (int)player_Ex.HPBarPosition.Y + offset + 28 * scale), }; member.Spell3Rectangle = Spell3Rectangle; Spell3Rectangle.Add(0); var Spell3Text = new Render.Text((int)player_Ex.HPBarPosition.X + 44, (int)player_Ex.HPBarPosition.Y + 33, string.Empty, 14, new ColorBGRA(255, 255, 255, 255)) { TextUpdate = () => ((player_Ex.Spellbook.GetSpell(slot3).CooldownExpires - Game.Time) > 0 ? (Truncate((player_Ex.Spellbook.GetSpell(slot3).CooldownExpires - Game.Time))) : string.Empty), PositionUpdate = () => new Vector2((int)player_Ex.HPBarPosition.X + offsetX + 73.8f * scale, (int)player_Ex.HPBarPosition.Y + offset + 33 * scale), VisibleCondition = sender => MenuExtensions.GetItemValue<bool>("dz191.dza.tracker.track.cd") && player_Ex.IsHPBarRendered && (player_Ex.Spellbook.GetSpell(slot3).CooldownExpires - Game.Time) > 0 && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)) }; member.Spell3Text = Spell3Text; Spell3Text.Add(0); #endregion #region Spell4 var slot4 = SpellSlot.R; var Spell4Rectangle = new Render.Sprite(Resources.CooldownSprite, new Vector2((int)player_Ex.HPBarPosition.X + 41, (int)player_Ex.HPBarPosition.Y + 30)) { VisibleCondition = sender => player_Ex.IsHPBarRendered && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)), PositionUpdate = () => new Vector2(player_Ex.HPBarPosition.X + offsetX + 96f * scale, (int)player_Ex.HPBarPosition.Y + offset + 28 * scale), }; member.Spell4Rectangle = Spell4Rectangle; Spell4Rectangle.Add(0); var Spell4Text = new Render.Text((int)player_Ex.HPBarPosition.X + 44, (int)player_Ex.HPBarPosition.Y + 33, string.Empty, 14, new ColorBGRA(255, 255, 255, 255)) { TextUpdate = () => ((player_Ex.Spellbook.GetSpell(slot4).CooldownExpires - Game.Time) > 0 ? (Truncate((player_Ex.Spellbook.GetSpell(slot4).CooldownExpires - Game.Time))) : string.Empty), PositionUpdate = () => new Vector2((int)player_Ex.HPBarPosition.X + offsetX + 101f * scale, (int)player_Ex.HPBarPosition.Y + offset + 33 * scale), VisibleCondition = sender => MenuExtensions.GetItemValue<bool>("dz191.dza.tracker.track.cd") && player_Ex.IsHPBarRendered && (player_Ex.Spellbook.GetSpell(slot4).CooldownExpires - Game.Time) > 0 && (((player_Ex.IsAlly || player_Ex.IsMe) && TrackerVariables.TrackAllies) || (player_Ex.IsEnemy && TrackerVariables.TrackEnemies)) }; member.Spell4Text = Spell4Text; Spell4Text.Add(0); #endregion #endregion member.Hero = player_Ex; member.Hud = Hudsprite; member.Summoner1 = SummonerSpell1; member.Summoner2 = SummonerSpell2; TrackerWrappers.Add(member); } catch (Exception e) { LogHelper.AddToLog(new LogItem("Tracker_Drawings", e, LogSeverity.Severe)); } } }
private void Init() { Render.Rectangle rec = new Render.Rectangle(Drawing.Width / 2 - 200 / 2, (int)(Drawing.Height / 1.5f), 200, 10, SharpDX.Color.Black); rec.VisibleCondition = delegate { return IsActive() && _recalls.Any(x => x.Recall.Status == Packet.S2C.Teleport.Status.Start); }; rec.Add(); }