示例#1
0
 private void Game_OnGameUpdate(EventArgs args)
 {
     if (Evade.GetTickCount() - lastCheckTime > 100)
     {
         CheckCasterDead();
         CheckSpellEndTime();
         lastCheckTime = Evade.GetTickCount();
     }
 }
        private void SpellDetector_OnProcessDetectedSpells()
        {
            //var pos1 = newSpell.startPos;//SpellDetector.GetCurrentSpellPosition(newSpell);
            //Utility.DelayAction.Add(250, () => CompareSpellLocation2(newSpell));

            sortedBestPos   = EvadeHelper.GetBestPositionTest();
            circleRenderPos = Evade.lastPosInfo.position;

            lastSpellCastTime = Evade.GetTickCount();
        }
示例#3
0
 public PositionInfo(
     Vector2 position,
     bool isDangerousPos,
     float distanceToMouse)
 {
     this.position        = position;
     this.isDangerousPos  = isDangerousPos;
     this.distanceToMouse = distanceToMouse;
     this.timestamp       = Evade.GetTickCount();
 }
 private void Game_OnGameUpdate(EventArgs args)
 {
     if (Evade.GetTickCount() - lastCheckTime > 1)
     {
         //CheckCasterDead();
         CheckSpellEndTime();
         AddDetectedSpells();
         lastCheckTime = Evade.GetTickCount();
     }
 }
 public static void MoveTo(Vector2 movePos)
 {
     Evade.lastEvadeCommand = new EvadeCommand
     {
         order          = EvadeOrderCommand.MoveTo,
         targetPosition = movePos,
         timestamp      = Evade.GetTickCount(),
         isProcessed    = false
     };
     myHero.IssueOrder(GameObjectOrder.MoveTo, movePos.To3D(), false);
 }
示例#6
0
 private void Game_OnGameUpdate(EventArgs args)
 {
     if (startWalkTime > 0)
     {
         if (Evade.GetTickCount() - startWalkTime > 500 && myHero.IsMoving == false)
         {
             //Game.PrintChat("walkspeed: " + startWalkPos.Distance(myHero.ServerPosition.To2D()) / (Evade.GetTickCount() - startWalkTime));
             startWalkTime = 0;
         }
     }
 }
示例#7
0
        public static void CheckDashing()
        {
            if (Evade.GetTickCount() - lastSpellEvadeCommand.timestamp < 250 && myHero.IsDashing() &&
                lastSpellEvadeCommand.evadeSpellData.evadeType == EvadeType.Dash)
            {
                var dashInfo = myHero.GetDashInfo();

                //Game.PrintChat("" + dashInfo.EndPos.Distance(lastSpellEvadeCommand.targetPosition));
                lastSpellEvadeCommand.targetPosition = dashInfo.EndPos;
            }
        }
        public static void CastSpell(EvadeSpellData spellData)
        {
            EvadeSpell.lastSpellEvadeCommand = new EvadeCommand
            {
                order          = EvadeOrderCommand.CastSpell,
                evadeSpellData = spellData,
                timestamp      = Evade.GetTickCount(),
                isProcessed    = false
            };

            myHero.Spellbook.CastSpell(spellData.spellKey, false);
        }
        private void CompareSpellLocation2(Spell spell)
        {
            var pos1    = spell.GetCurrentSpellPosition();
            var timeNow = Evade.GetTickCount();

            if (spell.spellObject != null)
            {
                Game.PrintChat("start distance: " + (spell.startPos.Distance(pos1)));
            }

            Utility.DelayAction.Add(250, () => CompareSpellLocation(spell, pos1, timeNow));
        }
        public static void CastSpell(EvadeSpellData spellData, Vector2 movePos)
        {
            EvadeSpell.lastSpellEvadeCommand = new EvadeCommand
            {
                order          = EvadeOrderCommand.CastSpell,
                targetPosition = movePos,
                evadeSpellData = spellData,
                timestamp      = Evade.GetTickCount(),
                isProcessed    = false
            };

            myHero.Spellbook.CastSpell(spellData.spellKey, movePos.To3D(), false);
        }
        private static void AddDetectedSpells()
        {
            bool spellAdded = false;

            foreach (KeyValuePair <int, Spell> entry in detectedSpells)
            {
                Spell spell = entry.Value;

                float evadeTime, spellHitTime;
                spell.CanHeroEvade(myHero, out evadeTime, out spellHitTime);

                spell.spellHitTime = spellHitTime;
                spell.evadeTime    = evadeTime;

                if (spell.spellHitTime - spell.evadeTime < 1500 && CanHeroWalkIntoSpell(spell))
                {
                    Spell newSpell = spell;
                    int   spellID  = spell.spellID;

                    if (!drawSpells.ContainsKey(spell.spellID))
                    {
                        drawSpells.Add(spellID, newSpell);
                    }

                    if (!spells.ContainsKey(spell.spellID))
                    {
                        if (!(Evade.isDodgeDangerousEnabled() && newSpell.GetSpellDangerLevel() < 3) &&
                            Evade.menu.SubMenu("Spells").SubMenu(newSpell.info.charName + newSpell.info.spellName + "Settings")
                            .Item(newSpell.info.spellName + "DodgeSpell").GetValue <bool>())
                        {
                            if (newSpell.info.spellType == SpellType.Circular &&
                                Evade.menu.SubMenu("Main").Item("DodgeCircularSpells").GetValue <bool>() == false)
                            {
                                //return spellID;
                                continue;
                            }

                            spells.Add(spellID, newSpell);

                            spellAdded = true;
                        }
                    }
                }
            }

            if (spellAdded && OnProcessDetectedSpells != null)
            {
                OnProcessDetectedSpells();
            }
        }
 private static void RenderTestCircles()
 {
     foreach (RenderPosition rendPos in renderPositions)
     {
         if (rendPos.renderEndTime - Evade.GetTickCount() > 0)
         {
             Render.Circle.DrawCircle(rendPos.renderPosition.To3D(), 50, Color.White, 3);
         }
         else
         {
             Utility.DelayAction.Add(1, () => renderPositions.Remove(rendPos));
         }
     }
 }
示例#13
0
        public static float GetSpellHitTime(Spell spell, Vector2 pos)
        {
            if (spell.info.spellType == SpellType.Line)
            {
                var spellPos = SpellDetector.GetCurrentSpellPosition(spell, true, Game.Ping);
                return(1000 * spellPos.Distance(pos) / spell.info.projectileSpeed);
            }
            else if (spell.info.spellType == SpellType.Circular)
            {
                return(Math.Max(0, spell.endTime - Evade.GetTickCount() - Game.Ping));
            }

            return(float.MaxValue);
        }
        private void Game_ProcessSpell(Obj_AI_Base hero, GameObjectProcessSpellCastEventArgs args)
        {
            try
            {
                if (hero.IsMe)
                {
                    string name;
                    if (channeledSpells.TryGetValue(args.SData.Name, out name))
                    {
                        Evade.isChanneling    = true;
                        Evade.channelPosition = myHero.ServerPosition.To2D();
                    }

                    var castTime = (hero.Spellbook.CastTime - Game.Time) * 1000;
                    if (castTime > 0 && hero.Spellbook.IsCastingSpell)
                    {
                        var extraDelayBuffer = Evade.menu.Item("ExtraPingBuffer").GetValue <Slider>().Value;
                        Evade.lastWindupTime = Evade.GetTickCount() + castTime - Game.Ping - extraDelayBuffer;
                    }
                }


                SpellData spellData;

                if (hero.Team != myHero.Team && onProcessSpells.TryGetValue(args.SData.Name, out spellData))
                {
                    if (spellData.usePackets == false)
                    {
                        var specialSpellArgs = new SpecialSpellEventArgs();
                        if (OnProcessSpecialSpell != null)
                        {
                            OnProcessSpecialSpell(hero, args, spellData, specialSpellArgs);
                        }

                        if (specialSpellArgs.noProcess == false && spellData.noProcess == false)
                        {
                            CreateSpellData(hero, args.Start, args.End, spellData, null);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Game.PrintChat(e.StackTrace);
            }
        }
示例#15
0
        private void DrawEvadeStatus()
        {
            if (ObjectCache.menuCache.cache["ShowStatus"].GetValue <bool>())
            {
                var heroPos   = Drawing.WorldToScreen(ObjectManager.Player.Position);
                var dimension = Drawing.GetTextEntent("Evade: ON", 0);

                if (ObjectCache.menuCache.cache["DodgeSkillShots"].GetValue <KeyBind>().Active)
                {
                    if (Evade.isDodging)
                    {
                        Drawing.DrawText(heroPos.X - dimension.Width / 2, heroPos.Y, Color.Red, "Evade: ON");
                    }
                    else
                    {
                        if (ObjectCache.menuCache.cache["DodgeOnlyOnComboKeyEnabled"].GetValue <bool>() == true &&
                            ObjectCache.menuCache.cache["DodgeComboKey"].GetValue <KeyBind>().Active == false)
                        {
                            Drawing.DrawText(heroPos.X - dimension.Width / 2, heroPos.Y, Color.Gray, "Evade: OFF");
                        }
                        else
                        {
                            if (Evade.isDodgeDangerousEnabled())
                            {
                                Drawing.DrawText(heroPos.X - dimension.Width / 2, heroPos.Y, Color.Yellow, "Evade: ON");
                            }
                            else
                            {
                                Drawing.DrawText(heroPos.X - dimension.Width / 2, heroPos.Y, Color.White, "Evade: ON");
                            }
                        }
                    }
                }
                else
                {
                    if (ObjectCache.menuCache.cache["ActivateEvadeSpells"].GetValue <KeyBind>().Active)
                    {
                        Drawing.DrawText(heroPos.X - dimension.Width / 2, heroPos.Y, Color.Purple, "Evade: Spell");
                    }
                    else
                    {
                        Drawing.DrawText(heroPos.X - dimension.Width / 2, heroPos.Y, Color.Gray, "Evade: OFF");
                    }
                }
            }
        }
示例#16
0
 public PositionInfo(
     Vector2 position,
     int posDangerLevel,
     int posDangerCount,
     bool isDangerousPos,
     float distanceToMouse,
     List <int> dodgeableSpells,
     List <int> undodgeableSpells)
 {
     this.position          = position;
     this.posDangerLevel    = posDangerLevel;
     this.posDangerCount    = posDangerCount;
     this.isDangerousPos    = isDangerousPos;
     this.distanceToMouse   = distanceToMouse;
     this.dodgeableSpells   = dodgeableSpells;
     this.undodgeableSpells = undodgeableSpells;
     this.timestamp         = Evade.GetTickCount();
 }
示例#17
0
        private void DrawEvadeStatus()
        {
            if (menu.SubMenu("Draw").Item("ShowStatus").GetValue <bool>())
            {
                var heroPos   = Drawing.WorldToScreen(ObjectManager.Player.Position);
                var dimension = Drawing.GetTextExtent("Evade: ON");

                if (menu.SubMenu("Main").Item("DodgeSkillShots").GetValue <KeyBind>().Active &&
                    Evade.isDodgeDangerousEnabled())
                {
                    Drawing.DrawText(heroPos.X - dimension.Width / 2, heroPos.Y, Color.Red, "Evade: ON");
                }
                else if (menu.SubMenu("Main").Item("DodgeSkillShots").GetValue <KeyBind>().Active)
                {
                    Drawing.DrawText(heroPos.X - dimension.Width / 2, heroPos.Y, Color.White, "Evade: ON");
                }
            }
        }
示例#18
0
        public static void UseEvadeSpell()
        {
            if (!Situation.ShouldUseEvadeSpell())
            {
                return;
            }

            //int posDangerlevel = EvadeHelper.CheckPosDangerLevel(ObjectCache.myHeroCache.serverPos2D, 0);

            if (EvadeUtils.TickCount - lastSpellEvadeCommand.timestamp < 1000)
            {
                return;
            }

            if (SpellDetector.spells.Select(entry => entry.Value).Where(ShouldActivateEvadeSpell).Any(spell => ActivateEvadeSpell(spell)))
            {
                Evade.SetAllUndodgeable();
                return;
            }
        }
示例#19
0
        public static Vector2 GetCurrentSpellPosition(this Spell spell, bool allowNegative = false, float delay = 0)
        {
            Vector2 spellPos = spell.startPos;

            if (spell.info.spellType == SpellType.Line)
            {
                float spellTime = Evade.GetTickCount() - spell.startTime - spell.info.spellDelay;

                if (spell.info.projectileSpeed == float.MaxValue)
                {
                    return(spell.startPos);
                }

                if (spellTime >= 0)
                {
                    spellPos = spell.startPos + spell.direction * spell.info.projectileSpeed * spellTime / 1000;
                }
                else if (allowNegative)
                {
                    spellPos = spell.startPos + spell.direction * spell.info.projectileSpeed * (spellTime / 1000);
                }
            }
            else if (spell.info.spellType == SpellType.Circular)
            {
                spellPos = spell.endPos;
            }

            if (spell.spellObject != null && spell.spellObject.IsValid)
            {
                spellPos = spell.spellObject.Position.To2D();
            }

            if (delay > 0)
            {
                spellPos = spellPos + spell.direction * spell.info.projectileSpeed * (delay / 1000);
            }

            return(spellPos);
        }
示例#20
0
        private void DrawEvadeStatus()
        {
            if (ObjectCache.menuCache.cache["ShowStatus"].Cast <CheckBox>().CurrentValue)
            {
                var heroPos   = Drawing.WorldToScreen(ObjectManager.Player.Position);
                var dimension = Drawing.GetTextEntent("Evade: ON", 12);

                if (ObjectCache.menuCache.cache["DodgeSkillShots"].Cast <KeyBind>().CurrentValue)
                {
                    if (Evade.isDodging)
                    {
                        Drawing.DrawText(heroPos.X - dimension.Width / 2, heroPos.Y, Color.Red, "Evade: ON");
                    }
                    else
                    {
                        if (Evade.isDodgeDangerousEnabled())
                        {
                            Drawing.DrawText(heroPos.X - dimension.Width / 2, heroPos.Y, Color.Yellow, "Evade: ON");
                        }
                        else
                        {
                            Drawing.DrawText(heroPos.X - dimension.Width / 2, heroPos.Y, Color.White, "Evade: ON");
                        }
                    }
                }
                else
                {
                    if (ObjectCache.menuCache.cache["ActivateEvadeSpells"].Cast <KeyBind>().CurrentValue)
                    {
                        Drawing.DrawText(heroPos.X - dimension.Width / 2, heroPos.Y, Color.Purple, "Evade: Spell");
                    }
                    else
                    {
                        Drawing.DrawText(heroPos.X - dimension.Width / 2, heroPos.Y, Color.Gray, "Evade: OFF");
                    }
                }
            }
        }
        private void CheckSpellEndTime()
        {
            foreach (KeyValuePair <int, Spell> entry in detectedSpells)
            {
                Spell spell = entry.Value;

                foreach (var hero in HeroManager.Enemies)
                {
                    if (hero.IsDead && spell.heroID == hero.NetworkId)
                    {
                        if (spell.spellObject == null)
                        {
                            Utility.DelayAction.Add(1, () => DeleteSpell(entry.Key));
                        }
                    }
                }

                if (spell.endTime < Evade.GetTickCount() || CanHeroWalkIntoSpell(spell) == false)
                {
                    Utility.DelayAction.Add(1, () => DeleteSpell(entry.Key));
                }
            }
        }
        public static void CreateSpellData(Obj_AI_Base hero, Vector3 startStartPos, Vector3 spellEndPos,
                                           SpellData spellData, GameObject obj = null, float extraEndTick = 0.0f, bool processSpell = true)
        {
            if (startStartPos.Distance(myHero.Position) < spellData.range + 1000)
            {
                Vector2 startPosition = startStartPos.To2D();
                Vector2 endPosition   = spellEndPos.To2D();
                Vector2 direction     = (endPosition - startPosition).Normalized();
                float   endTick       = 0;

                if (spellData.fixedRange) //for diana q
                {
                    if (endPosition.Distance(startPosition) > spellData.range)
                    {
                        //var heroCastPos = hero.ServerPosition.To2D();
                        //direction = (endPosition - heroCastPos).Normalized();
                        endPosition = startPosition + direction * spellData.range;
                    }
                }

                if (spellData.spellType == SpellType.Line)
                {
                    endTick     = spellData.spellDelay + (spellData.range / spellData.projectileSpeed) * 1000;
                    endPosition = startPosition + direction * spellData.range;

                    if (obj != null)
                    {
                        endTick -= spellData.spellDelay;
                    }
                }
                else if (spellData.spellType == SpellType.Circular)
                {
                    endTick = spellData.spellDelay;

                    if (spellData.projectileSpeed == 0)
                    {
                        endPosition = hero.ServerPosition.To2D();
                    }
                    else if (spellData.projectileSpeed > 0)
                    {
                        endTick = endTick + 1000 * startPosition.Distance(endPosition) / spellData.projectileSpeed;
                    }
                }
                else if (spellData.spellType == SpellType.Cone)
                {
                    return;
                }

                endTick += extraEndTick;

                Spell newSpell = new Spell();

                newSpell.startTime = Evade.GetTickCount();
                newSpell.endTime   = Evade.GetTickCount() + endTick;
                newSpell.startPos  = startPosition;
                newSpell.endPos    = endPosition;
                newSpell.direction = direction;
                newSpell.heroID    = hero.NetworkId;
                newSpell.info      = spellData;

                if (obj != null)
                {
                    newSpell.spellObject  = obj;
                    newSpell.projectileID = obj.NetworkId;
                }

                int spellID = CreateSpell(newSpell, processSpell);

                Utility.DelayAction.Add((int)endTick, () => DeleteSpell(spellID));
            }
        }
示例#23
0
        public static void UseEvadeSpell()
        {
            if (!Evade.menu.SubMenu("Main").Item("UseEvadeSpells").GetValue <bool>())
            {
                return;
            }

            //int posDangerlevel = EvadeHelper.CheckPosDangerLevel(myHero.ServerPosition.To2D(), 0);

            if (Evade.GetTickCount() - lastSpellEvadeCommand.timestamp < 1000)
            {
                return;
            }

            foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells)
            {
                Spell spell = entry.Value;

                if (!Evade.lastPosInfo.undodgeableSpells.Contains(spell.spellID))
                {
                    continue;
                }

                foreach (var evadeSpell in evadeSpells)
                {
                    if (Evade.menu.SubMenu("EvadeSpells").SubMenu(evadeSpell.charName + evadeSpell.name + "EvadeSpellSettings")
                        .Item(evadeSpell.name + "UseEvadeSpell").GetValue <bool>() == false ||
                        GetSpellDangerLevel(evadeSpell) > EvadeHelper.GetSpellDangerLevel(spell) ||
                        !(myHero.Spellbook.CanUseSpell(evadeSpell.spellKey) == SpellState.Ready))
                    {
                        continue; //can't use spell right now
                    }

                    if (evadeSpell.evadeType == EvadeType.Blink)
                    {
                        var posInfo = EvadeHelper.GetBestPositionBlink();
                        if (posInfo != null)
                        {
                            EvadeCommand.CastSpell(evadeSpell, posInfo.position);
                        }
                    }
                    else if (evadeSpell.evadeType == EvadeType.Dash)
                    {
                        var posInfo = EvadeHelper.GetBestPositionDash(evadeSpell);
                        if (posInfo != null)
                        {
                            if (evadeSpell.isReversed)
                            {
                                var dir   = (posInfo.position - myHero.ServerPosition.To2D()).Normalized();
                                var range = myHero.ServerPosition.To2D().Distance(posInfo.position);
                                var pos   = myHero.ServerPosition.To2D() - dir * range;

                                posInfo.position = pos;
                            }

                            EvadeCommand.CastSpell(evadeSpell, posInfo.position);
                        }
                    }
                    else if (evadeSpell.evadeType == EvadeType.SpellShield)
                    {
                        EvadeCommand.CastSpell(evadeSpell);
                    }

                    return;
                }
            }
        }
        private void Drawing_OnDraw(EventArgs args)
        {
            //PrintTimers();

            //EvadeHelper.CheckMovePath(Game.CursorPos.To2D());

            foreach (KeyValuePair <int, Spell> entry in SpellDetector.drawSpells)
            {
                Spell spell = entry.Value;

                if (spell.info.spellType == SpellType.Line)
                {
                    Vector2 spellPos = spell.GetCurrentSpellPosition();

                    Render.Circle.DrawCircle(new Vector3(spellPos.X, spellPos.Y, myHero.Position.Z), spell.info.radius, Color.White, 3);

                    /*spellPos = spellPos + spell.direction * spell.info.projectileSpeed * (60 / 1000); //move the spellPos by 50 miliseconds forwards
                     * spellPos = spellPos + spell.direction * 200; //move the spellPos by 50 units forwards
                     *
                     * Render.Circle.DrawCircle(new Vector3(spellPos.X, spellPos.Y, myHero.Position.Z), spell.info.radius, Color.White, 3);*/
                }
            }

            RenderTestCircles();

            if (testMenu.Item("TestHeroPos").GetValue <bool>())
            {
                var path = myHero.Path;
                if (path.Length > 0)
                {
                    var heroPos2 = EvadeHelper.GetRealHeroPos(Game.Ping + 50);// path[path.Length - 1].To2D();
                    var heroPos1 = myHero.ServerPosition.To2D();

                    Render.Circle.DrawCircle(new Vector3(heroPos2.X, heroPos2.Y, myHero.ServerPosition.Z), myHero.BoundingRadius, Color.Red, 3);
                    Render.Circle.DrawCircle(new Vector3(myHero.ServerPosition.X, myHero.ServerPosition.Y, myHero.ServerPosition.Z), myHero.BoundingRadius, Color.White, 3);

                    var heroPos   = Drawing.WorldToScreen(ObjectManager.Player.Position);
                    var dimension = Drawing.GetTextExtent("Evade: ON");
                    Drawing.DrawText(heroPos.X - dimension.Width / 2, heroPos.Y, Color.Red, "" + (int)(heroPos2.Distance(heroPos1)));

                    Render.Circle.DrawCircle(new Vector3(circleRenderPos.X, circleRenderPos.Y, myHero.ServerPosition.Z), 10, Color.Red, 3);
                }
            }

            if (testMenu.Item("DrawHeroPos").GetValue <bool>())
            {
                Render.Circle.DrawCircle(new Vector3(myHero.ServerPosition.X, myHero.ServerPosition.Y, myHero.ServerPosition.Z), myHero.BoundingRadius, Color.White, 3);
            }

            if (testMenu.Item("TestMoveTo").GetValue <KeyBind>().Active)
            {
                var keyBind = testMenu.Item("TestMoveTo").GetValue <KeyBind>();
                testMenu.Item("TestMoveTo").SetValue(new KeyBind(keyBind.Key, KeyBindType.Toggle, false));

                myHero.IssueOrder(GameObjectOrder.MoveTo, Game.CursorPos);

                var dir  = (Game.CursorPos - myHero.Position).Normalized();
                var pos2 = myHero.Position - dir * Game.CursorPos.Distance(myHero.Position);

                Utility.DelayAction.Add(1, () => myHero.IssueOrder(GameObjectOrder.MoveTo, pos2));
            }

            if (testMenu.Item("TestPath").GetValue <bool>())
            {
                var     tPath     = myHero.GetPath(Game.CursorPos);
                Vector2 lastPoint = Vector2.Zero;

                foreach (Vector3 point in tPath)
                {
                    var point2D = point.To2D();
                    //Render.Circle.DrawCircle(new Vector3(point.X, point.Y, point.Z), myHero.BoundingRadius, Color.Violet, 3);

                    lastPoint = point2D;
                }
            }

            if (testMenu.Item("TestPath").GetValue <bool>())
            {
                var     tPath     = myHero.GetPath(Game.CursorPos);
                Vector2 lastPoint = Vector2.Zero;

                foreach (Vector3 point in tPath)
                {
                    var point2D = point.To2D();
                    //Render.Circle.DrawCircle(new Vector3(point.X, point.Y, point.Z), myHero.BoundingRadius, Color.Violet, 3);

                    lastPoint = point2D;
                }

                foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells)
                {
                    Spell spell = entry.Value;

                    Vector2 to = Game.CursorPos.To2D();
                    var     dir = (to - myHero.Position.To2D()).Normalized();
                    Vector2 cPos1, cPos2;

                    var cpa     = MathUtilsCPA.CPAPointsEx(myHero.Position.To2D(), dir * myHero.MoveSpeed, spell.endPos, spell.direction * spell.info.projectileSpeed, to, spell.endPos);
                    var cpaTime = MathUtilsCPA.CPATime(myHero.Position.To2D(), dir * myHero.MoveSpeed, spell.endPos, spell.direction * spell.info.projectileSpeed);

                    //Game.PrintChat("" + cpaTime);
                    //Render.Circle.DrawCircle(cPos1.To3D(), myHero.BoundingRadius, Color.Red, 3);

                    if (cpa < myHero.BoundingRadius + spell.GetSpellRadius())
                    {
                    }
                }
            }

            if (testMenu.Item("ShowBuffs").GetValue <bool>())
            {
                var target = myHero;

                foreach (var hero in HeroManager.Enemies)
                {
                    target = hero;
                }

                var buffs = target.Buffs;

                //Game.PrintChat(myHero.ChampionName);

                //if(myHero.IsDead)
                //    Game.PrintChat("dead");

                if (!target.IsTargetable)
                {
                    Game.PrintChat("invul" + Evade.GetTickCount());
                }

                int height = 20;

                foreach (var buff in buffs)
                {
                    if (buff.IsValidBuff())
                    {
                        Drawing.DrawText(10, height, Color.White, buff.Name);
                        height += 20;

                        Game.PrintChat(buff.Name);
                    }
                }
            }

            if (testMenu.Item("TestTracker").GetValue <bool>())
            {
                foreach (KeyValuePair <int, ObjectTrackerInfo> entry in SpecialSpells.objTracker)
                {
                    var info = entry.Value;

                    Vector3 endPos2;
                    if (info.usePosition == false)
                    {
                        endPos2 = info.obj.Position;
                    }
                    else
                    {
                        endPos2 = info.position;
                    }

                    Render.Circle.DrawCircle(new Vector3(endPos2.X, endPos2.Y, myHero.Position.Z), 50, Color.Green, 3);
                }
            }

            if (testMenu.Item("TestWall").GetValue <bool>())
            {
                foreach (var posInfo in sortedBestPos)
                {
                    var posOnScreen = Drawing.WorldToScreen(posInfo.position.To3D());
                    //Drawing.DrawText(posOnScreen.X, posOnScreen.Y, Color.Aqua, "" + (int)posInfo.closestDistance);

                    /*
                     * if (!posInfo.rejectPosition)
                     * {
                     *  Drawing.DrawText(posOnScreen.X, posOnScreen.Y, Color.Aqua, "" + (int)posInfo.closestDistance);
                     * }*/

                    Drawing.DrawText(posOnScreen.X, posOnScreen.Y, Color.Aqua, "" + (int)posInfo.closestDistance);

                    /*if (posInfo.posDangerCount <= 0)
                     * {
                     *  var pos = posInfo.position;
                     *  Render.Circle.DrawCircle(new Vector3(pos.X, pos.Y, myHero.Position.Z), (float)25, Color.White, 3);
                     * }*/
                }
            }
        }
        private void Game_OnIssueOrder(Obj_AI_Base hero, GameObjectIssueOrderEventArgs args)
        {
            if (!hero.IsMe)
            {
                return;
            }

            if (args.Order == GameObjectOrder.HoldPosition)
            {
                var path      = myHero.Path;
                var heroPoint = myHero.ServerPosition.To2D();


                if (path.Length > 0)
                {
                    var movePos = path[path.Length - 1].To2D();
                    var walkDir = (movePos - heroPoint).Normalized();

                    //circleRenderPos = EvadeHelper.GetRealHeroPos();
                    //heroPoint;// +walkDir * myHero.MoveSpeed * (((float)Game.Ping) / 1000);
                }
            }


            /*
             * if (args.Order == GameObjectOrder.MoveTo)
             * {
             *  if (testingCollision)
             *  {
             *      if (args.TargetPosition.To2D().Distance(testCollisionPos) < 3)
             *      {
             *          //var path = myHero.GetPath();
             *          //circleRenderPos
             *
             *          args.Process = false;
             *      }
             *  }
             * }*/

            if (args.Order == GameObjectOrder.MoveTo)
            {
                Vector2 heroPos = myHero.ServerPosition.To2D();
                Vector2 pos     = args.TargetPosition.To2D();
                float   speed   = myHero.MoveSpeed;

                startWalkPos  = heroPos;
                startWalkTime = Evade.GetTickCount();

                foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells)
                {
                    Spell spell    = entry.Value;
                    var   spellPos = spell.GetCurrentSpellPosition();
                    var   walkDir  = (pos - heroPos).Normalized();


                    float spellTime = (Evade.GetTickCount() - spell.startTime) - spell.info.spellDelay;
                    spellPos = spell.startPos + spell.direction * spell.info.projectileSpeed * (spellTime / 1000);
                    //Game.PrintChat("aaaa" + spellTime);


                    bool  isCollision         = false;
                    float movingCollisionTime = MathUtils.GetCollisionTime(heroPos, spellPos, walkDir * (speed - 25), spell.direction * (spell.info.projectileSpeed - 200), myHero.BoundingRadius, spell.GetSpellRadius(), out isCollision);
                    if (isCollision)
                    {
                        //Game.PrintChat("aaaa" + spellPos.Distance(spell.endPos) / spell.info.projectileSpeed);
                        if (true)//spellPos.Distance(spell.endPos) / spell.info.projectileSpeed > movingCollisionTime)
                        {
                            Game.PrintChat("movingCollisionTime: " + movingCollisionTime);
                            //circleRenderPos = heroPos + walkDir * speed * movingCollisionTime;
                        }
                    }
                }
            }
        }
示例#26
0
        private void Game_OnGameUpdate(EventArgs args)
        {
            if (testMenu.Item("AutoSetPing").GetValue <bool>())
            {
                Game.PrintChat("Testing Ping...Please wait 10 seconds");

                int testAmount = 20;

                testMenu.Item("AutoSetPing").SetValue(false);
                IssueTestMove(testAmount);
                autoTestCount = testCount + testAmount;
                autoTestPing  = true;
            }

            if (testMenu.Item("PrintResults").GetValue <bool>())
            {
                testMenu.Item("PrintResults").SetValue(false);

                Game.PrintChat("Average Extra Delay: " + averagePingTime);
                Game.PrintChat("Max Extra Delay: " + maxPingTime);
            }

            if (autoTestPing == true && testCount >= autoTestCount)
            {
                Game.PrintChat("Auto Set Ping Complete");

                Game.PrintChat("Average Extra Delay: " + averagePingTime);
                Game.PrintChat("Max Extra Delay: " + maxPingTime);

                SetPing((int)(averagePingTime + 10));
                Game.PrintChat("Set Average extra ping + 10: " + (averagePingTime + 10));

                autoTestPing = false;
            }

            if (testMenu.Item("TestMoveTime").GetValue <bool>())
            {
                testMenu.Item("TestMoveTime").SetValue(false);
                IssueTestMove(1);
            }


            if (testMenu.Item("Test20MoveTime").GetValue <bool>())
            {
                testMenu.Item("Test20MoveTime").SetValue(false);
                IssueTestMove(20);
            }

            if (testMenu.Item("SetMaxPing").GetValue <bool>())
            {
                testMenu.Item("SetMaxPing").SetValue(false);

                if (testCount < 10)
                {
                    Game.PrintChat("Please test 10 times before setting ping");
                }
                else
                {
                    Game.PrintChat("Set Max extra ping: " + maxPingTime);
                    SetPing((int)maxPingTime);
                }
            }

            if (testMenu.Item("SetAvgPing").GetValue <bool>())
            {
                testMenu.Item("SetAvgPing").SetValue(false);

                if (testCount < 10)
                {
                    Game.PrintChat("Please test 10 times before setting ping");
                }
                else
                {
                    Game.PrintChat("Set Average extra ping: " + averagePingTime);
                    SetPing((int)averagePingTime);
                }
            }

            if (myHero.IsMoving)
            {
                if (lastTestMoveToCommand != null && lastTestMoveToCommand.isProcessed == false && lastTestMoveToCommand.order == EvadeOrderCommand.MoveTo)
                {
                    var path = myHero.Path;

                    if (path.Length > 0)
                    {
                        var movePos = path[path.Length - 1].To2D();

                        if (movePos.Distance(lastTestMoveToCommand.targetPosition) < 10)
                        {
                            float moveTime = Evade.GetTickCount() - lastTestMoveToCommand.timestamp - Game.Ping;
                            Game.PrintChat("Extra Delay: " + moveTime);
                            lastTestMoveToCommand.isProcessed = true;

                            sumPingTime    += moveTime;
                            testCount      += 1;
                            averagePingTime = sumPingTime / testCount;
                            maxPingTime     = Math.Max(maxPingTime, moveTime);
                        }
                    }
                }
            }
        }
示例#27
0
 static void Main(string[] args)
 {
     evade = new Evade();
 }
示例#28
0
        public static bool PredictSpellCollision(Spell spell, Vector2 pos, float speed, float delay, Vector2 heroPos, float extraDist)
        {
            var walkDir = (pos - heroPos).Normalized();
            var zVector = new Vector2(0, 0);

            /*
             * if (Evade.menu.SubMenu("MiscSettings").Item("CalculateHeroPos").GetValue<bool>())
             *  heroPos = GetRealHeroPos(); //testing*/

            /*if (!myHero.IsMoving)
             *  walkDir = zVector;*/

            if (spell.info.spellType == SpellType.Line)
            {
                //zVector


                if (spell.info.projectileSpeed == float.MaxValue)
                {
                }

                var spellPos = SpellDetector.GetCurrentSpellPosition(spell, true);

                //Using triple checks
                //Check if skillshot will hit pos if hero is standing still
                bool isCollision = false;

                float standingCollisionTime = MathUtils.GetCollisionTime(pos, spellPos, zVector, spell.direction * spell.info.projectileSpeed, myHero.BoundingRadius, GetSpellRadius(spell), out isCollision);
                if (isCollision && standingCollisionTime > 0)
                {
                    if (spellPos.Distance(spell.endPos) / spell.info.projectileSpeed > standingCollisionTime)
                    {
                        return(true); //if collision happens when the skillshot is in flight
                    }
                }

                return(GetClosestDistanceApproach(spell, pos, speed, delay, heroPos, extraDist) == 0);

                /*
                 * //Check if skillshot will hit hero if hero is moving
                 * float movingCollisionTime = MathUtils.GetCollisionTime(heroPos, spellPos, walkDir * speed, spell.direction * spell.info.projectileSpeed, myHero.BoundingRadius, GetSpellRadius(spell) + 5, out isCollision);
                 * if (isCollision && movingCollisionTime > 0)
                 * {
                 *  if (spellPos.Distance(spell.endPos) / spell.info.projectileSpeed > movingCollisionTime)
                 *      return true; //if collision happens when the skillshot is in flight
                 * }
                 *
                 *
                 * //Check if skillshot will hit hero if hero is moving and the skillshot is moved forwards by 50 units
                 *
                 * spellPos = spellPos + spell.direction * spell.info.projectileSpeed * (delay / 1000); //move the spellPos by 50 miliseconds forwards
                 * spellPos = spellPos + spell.direction * 50; //move the spellPos by 50 units forwards
                 *
                 * var finalExtraDelay = (50 / spell.info.projectileSpeed) + (delay / 1000);
                 *
                 * float extraCollisionTime = MathUtils.GetCollisionTime(heroPos, spellPos, walkDir * speed, spell.direction * spell.info.projectileSpeed, myHero.BoundingRadius, GetSpellRadius(spell) + 5, out isCollision);
                 * if (isCollision && extraCollisionTime > -finalExtraDelay)
                 * {
                 *  if (spellPos.Distance(spell.endPos) / spell.info.projectileSpeed > extraCollisionTime)
                 *      return true; //if collision happens when the skillshot is in flight
                 *  else
                 *      return false;
                 * }*/
            }
            else if (spell.info.spellType == SpellType.Circular)
            {
                var spellHitTime   = Math.Max(0, spell.endTime - Evade.GetTickCount()); //extraDelay
                var walkRange      = heroPos.Distance(pos);
                var predictedRange = speed * (spellHitTime / 1000);
                var tHeroPos       = heroPos + walkDir * Math.Min(predictedRange, walkRange);             //Hero predicted pos

                return(tHeroPos.Distance(spell.endPos) <= GetSpellRadius(spell) + myHero.BoundingRadius); //+ dodgeBuffer
            }
            else if (spell.info.spellType == SpellType.Cone)
            {
                var spellHitTime = Math.Max(0, spell.endTime - Evade.GetTickCount());  //extraDelay
                var tHeroPos     = heroPos + walkDir * speed * (spellHitTime / 1000);

                return(inSkillShot(spell, tHeroPos, myHero.BoundingRadius));
            }

            return(false);
        }
示例#29
0
 static void Main(string[] args)
 {
     evade = new Evade();
 }
示例#30
0
        private static void AddDetectedSpells()
        {
            bool spellAdded = false;

            foreach (KeyValuePair <int, Spell> entry in detectedSpells)
            {
                Spell spell = entry.Value;

                float evadeTime, spellHitTime;
                spell.CanHeroEvade(myHero, out evadeTime, out spellHitTime);

                spell.spellHitTime = spellHitTime;
                spell.evadeTime    = evadeTime;

                var extraDelay = ObjectCache.gamePing + ObjectCache.menuCache.cache["ExtraPingBuffer"].GetValue <Slider>().Value;

                if (spell.spellHitTime - extraDelay < 1500 && CanHeroWalkIntoSpell(spell))
                //if(true)
                {
                    Spell newSpell = spell;
                    int   spellID  = spell.spellID;

                    if (!drawSpells.ContainsKey(spell.spellID))
                    {
                        drawSpells.Add(spellID, newSpell);
                    }

                    //var spellFlyTime = Evade.GetTickCount - spell.startTime;
                    if (spellHitTime < ObjectCache.menuCache.cache["SpellDetectionTime"].GetValue <Slider>().Value)
                    {
                        continue;
                    }

                    if (EvadeUtils.TickCount - spell.startTime <
                        ObjectCache.menuCache.cache["ReactionTime"].GetValue <Slider>().Value)
                    {
                        continue;
                    }

                    var dodgeInterval = ObjectCache.menuCache.cache["DodgeInterval"].GetValue <Slider>().Value;
                    if (Evade.lastPosInfo != null && dodgeInterval > 0)
                    {
                        var timeElapsed = EvadeUtils.TickCount - Evade.lastPosInfo.timestamp;

                        if (dodgeInterval > timeElapsed)
                        {
                            //var delay = dodgeInterval - timeElapsed;
                            //DelayAction.Add((int)delay, () => SpellDetector_OnProcessDetectedSpells());
                            continue;
                        }
                    }

                    if (!spells.ContainsKey(spell.spellID))
                    {
                        if (!(Evade.isDodgeDangerousEnabled() && newSpell.GetSpellDangerLevel() < 3) &&
                            ObjectCache.menuCache.cache[newSpell.info.spellName + "DodgeSpell"].GetValue <bool>())
                        {
                            if (newSpell.spellType == SpellType.Circular &&
                                ObjectCache.menuCache.cache["DodgeCircularSpells"].GetValue <bool>() == false)
                            {
                                //return spellID;
                                continue;
                            }

                            spells.Add(spellID, newSpell);

                            spellAdded = true;
                        }
                    }

                    if (ObjectCache.menuCache.cache["CheckSpellCollision"].GetValue <bool>() &&
                        spell.predictedEndPos != Vector2.Zero)
                    {
                        spellAdded = false;
                    }
                }
            }

            if (spellAdded && OnProcessDetectedSpells != null)
            {
                OnProcessDetectedSpells();
            }
        }
示例#31
0
 public static void Main()
 {
     evade = new Evade();
 }