Ejemplo n.º 1
0
        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;
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        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;
                        }
                    }
                }
            }
        }