public void OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (sender.Type == GameObjectType.AIHeroClient) { var hero = (AIHeroClient)sender; if (hero.IsEnemy) { if (JukeRevealer.CurrentValue) { switch (args.SData.Name) { case "SummonerFlash": case "Deceive": var color = FlashColor; var start = args.Start; var end = start.IsInRange(args.End, FlashRange) ? args.End : start.Extend(args.End, FlashRange).To3DWorld(); if (args.SData.Name == "Deceive") { if (EnemyShaco.Any(o => o.IdEquals(hero))) { color = ShacoColor; end = start.IsInRange(args.End, ShacoQRange) ? args.End : start.Extend(args.End, ShacoQRange).To3DWorld(); } else { break; } } end = GetValidCastSpot(end); DrawingDraw drawJuke = bla => { EloBuddy.SDK.Rendering.Circle.Draw(color, JukeRevealerCircleRadius, JukeRevealerLineWidth, end); EloBuddy.SDK.Rendering.Line.DrawLine(Color.FromArgb(color.A, color.R, color.G, color.B), JukeRevealerLineWidth, start, start.Extend(end, start.Distance(end) - JukeRevealerCircleRadius).To3D((int)end.Z)); }; Drawing.OnDraw += drawJuke; if (JukeTimer.CurrentValue > 1) { Core.DelayAction(() => { if (hero.IsHPBarRendered) { Drawing.OnDraw -= drawJuke; } }, 1000); } Core.DelayAction(() => { Drawing.OnDraw -= drawJuke; }, JukeTimer.CurrentValue * 1000); break; } } } } }
private void Game_OnSendPacket(GamePacketEventArgs args) { try { if (Game.Mode != GameMode.Running && IsActive()) { //Console.Write("Packet Sent: "); //Array.ForEach(args.PacketData, x => Console.Write(x + " ")); //Console.WriteLine(); if (args.PacketData.Length != 6 || packetSent || packet != null) return; args.Process = false; packet = new MemoryStream(args.PacketData, 0, args.PacketData.Length); Notifications.RemoveNotification(notification); notification.Dispose(); notification = Common.ShowNotification("Press spacebar to continue.", Color.YellowGreen, -1); ms = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond; drawingEvent = delegate { if (!packetSent && (ms + (250 * 1000)) < (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond)) { Console.WriteLine((ms + (250 * 1000)) + " " + DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond); Game.SendPacket(packet.ToArray(), PacketChannel.C2S, PacketProtocolFlags.Reliable); packetSent = true; if (notification != null) { Notifications.RemoveNotification(notification); notification.Dispose(); } if (notificationRemaining != null) { Notifications.RemoveNotification(notificationRemaining); notificationRemaining.Dispose(); } notification = Common.ShowNotification("Game starts now. Prepare!", Color.OrangeRed, 1000); Drawing.OnDraw -= drawingEvent; } else { if (notificationRemaining == null) { notificationRemaining = Common.ShowNotification( "Remaining: " + (ms + (250 * 1000) - DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond).ToString(), Color.YellowGreen, 250 * 1000); } else { notificationRemaining.Text = "Remaining: " + ((ms + (250 * 1000) - DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) / 1000).ToString() + "s"; } } }; Drawing.OnDraw += drawingEvent; } else { if (notification != null) { Notifications.RemoveNotification(notification); notification.Dispose(); } if (notificationRemaining != null) { Notifications.RemoveNotification(notificationRemaining); notificationRemaining.Dispose(); } } } catch (Exception) { } }
private void OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (sender.Type == GameObjectType.AIHeroClient) { var hero = (AIHeroClient)sender; if (hero.IsEnemy) { // Juke Revealer if (JukeRevealer.CurrentValue) { switch (args.SData.Name) { case "SummonerFlash": case "Deceive": // Assume the spell casted was Flash var color = FlashColor; var start = args.Start; var end = start.IsInRange(args.End, FlashRange) ? args.End : start.Extend(args.End, FlashRange).To3DWorld(); if (args.SData.Name == "Deceive") { if (EnemyShaco.Any(o => o.IdEquals(hero))) { // Apply Shaco data color = ShacoColor; end = start.IsInRange(args.End, ShacoQRange) ? args.End : start.Extend(args.End, ShacoQRange).To3DWorld(); } else { // No valid Shaco break; } } // Validate and adjust end location if needed end = end.GetValidCastSpot(); // Check vision on end location // TODO // Initialize the drawing DrawingDraw drawJuke = bla => { // End position Circle.Draw(color, JukeRevealerCircleRadius, JukeRevealerLineWidth, end); // Line from start to end Line.DrawLine(Color.FromArgb(color.A, color.R, color.G, color.B), JukeRevealerLineWidth, start, start.Extend(end, start.Distance(end) - JukeRevealerCircleRadius).To3D((int)end.Z)); }; // Add draw listener Drawing.OnDraw += drawJuke; // Remove drawing if the enemy is visible after 1 second // TODO: Remove once I can check the vision on the end location for the player if (JukeTimer.CurrentValue > 1) { Core.DelayAction(() => { if (hero.IsHPBarRendered) { Drawing.OnDraw -= drawJuke; } }, 1000); } // Remove drawing after 5 seconds Core.DelayAction(() => { Drawing.OnDraw -= drawJuke; }, JukeTimer.CurrentValue * 1000); break; } } } } }
private void Game_OnSendPacket(GamePacketEventArgs args) { try { if (Game.Mode != GameMode.Running || !IsActive()) { //Console.Write("Packet Sent: "); //args.PacketData.ForEach(x => Console.Write(x + " ")); //Console.WriteLine(); if (args.PacketData.Length != 6 || packetSent || packet != null) { return; } args.Process = false; packet = new MemoryStream(args.PacketData, 0, args.PacketData.Length); Notifications.RemoveNotification(notification); notification.Dispose(); notification = Common.ShowNotification("Press spacebar to continue.", Color.YellowGreen, -1); ms = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond; drawingEvent = delegate { if (!packetSent && (ms + (delay * 1000)) < (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond)) { Game.SendPacket(packet.ToArray(), PacketChannel.C2S, PacketProtocolFlags.Reliable); packetSent = true; if (notification != null) { Notifications.RemoveNotification(notification); notification.Dispose(); } if (notificationRemaining != null) { Notifications.RemoveNotification(notificationRemaining); notificationRemaining.Dispose(); } notification = Common.ShowNotification("Game starts now. Prepare!", Color.OrangeRed, 1000); Drawing.OnDraw -= drawingEvent; } else { if (notificationRemaining == null) { notificationRemaining = Common.ShowNotification( "Remaining: " + (ms + (delay * 1000) - DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond).ToString(), Color.YellowGreen, delay * 1000); } else { notificationRemaining.Text = "Remaining: " + ((ms + (delay * 1000) - DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond) / 1000).ToString() + "s"; } } }; Drawing.OnDraw += drawingEvent; } else { if (notification != null) { Notifications.RemoveNotification(notification); notification.Dispose(); } if (notificationRemaining != null) { Notifications.RemoveNotification(notificationRemaining); notificationRemaining.Dispose(); } } } catch (Exception) { } }