private void ContinueLastBlockedCommand() { if (ObjectCache.menuCache.cache["ContinueMovement"].As <MenuBool>().Enabled && Situation.ShouldDodge()) { var movePos = lastBlockedUserMoveTo.targetPosition; var extraDelay = ObjectCache.menuCache.cache["ExtraPingBuffer"].As <MenuSlider>().Value; if (isDodging == false && lastBlockedUserMoveTo.isProcessed == false && EvadeUtils.TickCount - lastEvadeCommand.timestamp > ObjectCache.gamePing + extraDelay && EvadeUtils.TickCount - lastBlockedUserMoveTo.timestamp < 1500) { movePos = movePos + (movePos - ObjectCache.myHeroCache.serverPos2D).Normalized() * EvadeUtils.random.Next(1, 65); if (!EvadeHelper.CheckMovePath(movePos, ObjectCache.gamePing + extraDelay)) { //Console.WriteLine("Continue Movement"); //myHero.IssueOrder(OrderType.MoveTo, movePos.To3D()); EvadeCommand.MoveTo(movePos); lastBlockedUserMoveTo.isProcessed = true; } } } }
private void ContinueLastBlockedCommand() { if (ConfigValue.ContinueMovement.GetBool() && Situation.ShouldDodge()) { var movePos = LastBlockedUserMoveTo.TargetPosition; var extraDelay = Config.Properties.GetInt(ConfigValue.ExtraPingBuffer); if (IsDodging == false && LastBlockedUserMoveTo.IsProcessed == false && EvadeUtils.TickCount - LastEvadeCommand.Timestamp > Game.Ping + extraDelay && EvadeUtils.TickCount - LastBlockedUserMoveTo.Timestamp < 1500) { movePos = movePos + (movePos - GameData.HeroInfo.ServerPos2D).Normalized() * EvadeUtils.Random.NextFloat(1, 65); if (!EvadeHelper.CheckMovePath(movePos, Game.Ping + extraDelay)) { //ConsoleDebug.WriteLine("Continue Movement"); //GameData.MyHero.IssueOrder(GameObjectOrder.MoveTo, movePos.To3D()); ConsoleDebug.WriteLineColor("Continuing Last Blocked Command", ConsoleColor.Yellow); EvadeCommand.MoveTo(movePos); LastBlockedUserMoveTo.IsProcessed = true; } } } }
private void DodgeSkillShots() { if (!Situation.ShouldDodge()) { IsDodging = false; return; } /* * if (isDodging && playerInDanger == false) //serverpos test * { * GameData.MyHero.IssueOrder(GameObjectOrder.HoldPosition, myHero, false); * }*/ if (IsDodging) { ConsoleDebug.WriteLineColor("Dodging Skill Shots by walking", ConsoleColor.Green); if (LastPosInfo != null) { /*foreach (KeyValuePair<int, Spell> entry in SpellDetector.spells) * { * Spell spell = entry.Value; * * ConsoleDebug.WriteLine("" + (int)(TickCount-spell.startTime)); * }*/ Vector2 lastBestPosition = LastPosInfo.Position; if (!ConfigValue.ClickOnlyOnce.GetBool() || !(GameData.MyHero.Path.Length > 0 && LastPosInfo.Position.Distance(GameData.MyHero.Path.Last().To2D()) < 5)) //|| lastPosInfo.timestamp > lastEvadeOrderTime) { EvadeCommand.MoveTo(lastBestPosition); LastEvadeOrderTime = EvadeUtils.TickCount; } } } else //if not dodging { //Check if hero will walk into a skillshot var path = GameData.MyHero.Path; if (path.Length > 0) { var movePos = path[path.Length - 1].To2D(); if (EvadeHelper.CheckMovePath(movePos)) { /*if (() Properties.Properties.Data["AllowCrossing"].Cast<CheckBox>().CurrentValue) * { * var extraDelayBuffer = () Properties.Properties.Data["ExtraPingBuffer"] + 30; + var extraDist = () Properties.Properties.Data["ExtraCPADistance"] + 10; + + var tPosInfo = EvadeHelper.CanHeroWalkToPos(movePos, GameData.HeroInfo.moveSpeed, extraDelayBuffer + Game.Ping, extraDist); + + if (tPosInfo.posDangerLevel == 0) + { + lastPosInfo = tPosInfo; + return; + } + }*/ var posInfo = EvadeHelper.GetBestPositionMovementBlock(movePos); if (posInfo != null) { EvadeCommand.MoveTo(posInfo.Position); } return; } } } }
private void Game_OnIssueOrder(Obj_AI_Base hero, PlayerIssueOrderEventArgs args) { if (!hero.IsMe) { return; } if (!Situation.ShouldDodge()) { return; } //DebugIssueOrders(args); if (args.Order == GameObjectOrder.MoveTo) { //movement block code goes in here if (IsDodging && SpellDetector.Spells.Count > 0) { ConsoleDebug.WriteLineColor("Issue Order detected while spells exist", ConsoleColor.Yellow); CheckHeroInDanger(); LastBlockedUserMoveTo = new EvadeCommand { Order = EvadeOrderCommand.MoveTo, TargetPosition = args.TargetPosition.To2D(), Timestamp = EvadeUtils.TickCount, IsProcessed = false, }; args.Process = false; //Block the command ConsoleDebug.WriteLineColor(" Blocked Movement Command", ConsoleColor.Red); } else { var movePos = args.TargetPosition.To2D(); var extraDelay = Config.Properties.GetInt(ConfigValue.ExtraPingBuffer); if (EvadeHelper.CheckMovePath(movePos, Game.Ping + extraDelay)) { ConsoleDebug.WriteLineColor("Move Path is colliding with spell", ConsoleColor.Yellow); /*if (() Properties.Properties.Data["AllowCrossing"].Cast<CheckBox>().CurrentValue) * { * var extraDelayBuffer = () Properties.Properties.Data["ExtraPingBuffer"] + 30; + var extraDist = () Properties.Properties.Data["ExtraCPADistance"] + 10; + + var tPosInfo = EvadeHelper.CanHeroWalkToPos(movePos, GameData.HeroInfo.moveSpeed, extraDelayBuffer + Game.Ping, extraDist); + + if (tPosInfo.posDangerLevel == 0) + { + lastPosInfo = tPosInfo; + return; + } + }*/ LastBlockedUserMoveTo = new EvadeCommand { Order = EvadeOrderCommand.MoveTo, TargetPosition = args.TargetPosition.To2D(), Timestamp = EvadeUtils.TickCount, IsProcessed = false, }; args.Process = false; //Block the command ConsoleDebug.WriteLineColor(" Blocked Movement Command", ConsoleColor.Red); if (EvadeUtils.TickCount - LastMovementBlockTime < 500 && LastMovementBlockPos.Distance(args.TargetPosition) < 100) { return; } LastMovementBlockPos = args.TargetPosition; LastMovementBlockTime = EvadeUtils.TickCount; var posInfo = EvadeHelper.GetBestPositionMovementBlock(movePos); if (posInfo != null) { EvadeCommand.MoveTo(posInfo.Position); } return; } else { LastBlockedUserMoveTo.IsProcessed = true; } } } else //need more logic { if (IsDodging) { args.Process = false; //Block the command ConsoleDebug.WriteLineColor(" Blocked IssueOrder(" + args.Order + ") Command", ConsoleColor.Red); } else { if (args.Order == GameObjectOrder.AttackUnit) { var target = args.Target; if (target != null && target.GetType() == typeof(Obj_AI_Base)) { var baseTarget = (Obj_AI_Base)target; if (baseTarget.IsValid()) { if (GameData.HeroInfo.ServerPos2D.Distance(baseTarget.ServerPosition.To2D()) > GameData.MyHero.AttackRange + GameData.HeroInfo.BoundingRadius + baseTarget.BoundingRadius) { var movePos = args.TargetPosition.To2D(); var extraDelay = Config.Properties.GetInt(ConfigValue.ExtraPingBuffer); if (EvadeHelper.CheckMovePath(movePos, Game.Ping + extraDelay)) { args.Process = false; //Block the command ConsoleDebug.WriteLineColor(" Blocked Attack Unit Command", ConsoleColor.Red); return; } } } } } } } if (args.Process == true) { LastIssueOrderGameTime = Game.Time * 1000; LastIssueOrderTime = EvadeUtils.TickCount; LastIssueOrderArgs = args; if (args.Order == GameObjectOrder.MoveTo) { LastMoveToPosition = args.TargetPosition.To2D(); LastMoveToServerPos = GameData.MyHero.ServerPosition.To2D(); } if (args.Order == GameObjectOrder.Stop) { LastStopPosition = GameData.MyHero.ServerPosition.To2D(); } } }
private void DodgeSkillShots() { if (!Situation.ShouldDodge()) { isDodging = false; return; } /* * if (isDodging && playerInDanger == false) //serverpos test * { * myHero.IssueOrder(OrderType.HoldPosition, myHero, false); * }*/ if (isDodging) { if (lastPosInfo != null) { /*foreach (KeyValuePair<int, Spell> entry in SpellDetector.spells) * { * Spell spell = entry.Value; * * Console.WriteLine("" + (int)(TickCount-spell.startTime)); * }*/ var lastBestPosition = lastPosInfo.position; if (ObjectCache.menuCache.cache["ClickOnlyOnce"].As <MenuBool>().Value == false || !(myHero.Path.Count() > 0 && lastPosInfo.position.Distance(myHero.Path.Last().To2D()) < 5)) //|| lastPosInfo.timestamp > lastEvadeOrderTime) { // Console.WriteLine("DodgeSkillshots"); EvadeCommand.MoveTo(lastBestPosition); lastEvadeOrderTime = EvadeUtils.TickCount; } } } else //if not dodging { //Check if hero will walk into a skillshot var path = myHero.Path; //if (path == null) // return; if (path.Length > 0) { var movePos = path[path.Length - 1].To2D(); if (EvadeHelper.CheckMovePath(movePos)) { /*if (ObjectCache.menuCache.cache["AllowCrossing"].As<MenuBool>().Enabled) * { * var extraDelayBuffer = ObjectCache.menuCache.cache["ExtraPingBuffer"] * .As<MenuSlider>().Value + 30; * var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"] * .As<MenuSlider>().Value + 10; * * var tPosInfo = EvadeHelper.CanHeroWalkToPos(movePos, ObjectCache.myHeroCache.moveSpeed, extraDelayBuffer + ObjectCache.gamePing, extraDist); * * if (tPosInfo.posDangerLevel == 0) * { * lastPosInfo = tPosInfo; * return; * } * }*/ var posInfo = EvadeHelper.GetBestPositionMovementBlock(movePos); if (posInfo != null) { EvadeCommand.MoveTo(posInfo.position); } } } } }
private void Game_OnIssueOrder(Obj_AI_Base hero, Obj_AI_BaseIssueOrderEventArgs args) { if (!hero.IsMe) { return; } if (!Situation.ShouldDodge()) { return; } //if (args.OrderType == OrderType.MoveTo) //{ // var end = args.Position; // var path = myHero.Path; // Console.WriteLine("got path"); //} if (args.OrderType == OrderType.MoveTo) { if (isDodging && SpellDetector.spells.Any()) { var limitDelay = ObjectCache.menuCache.cache["TickLimiter"].As <MenuSlider>(); //Tick limiter if (EvadeUtils.TickCount - lastTickCount < limitDelay.Value) { lastTickCount = EvadeUtils.TickCount; args.ProcessEvent = false; return; } CheckHeroInDanger(); lastBlockedUserMoveTo = new EvadeCommand { // fix all the args.Target.Position / args.Position order = EvadeOrderCommand.MoveTo, targetPosition = args /*.Target*/.Position.To2D(), // NOT SURE IF POSITION OR TARGET.POSITION timestamp = EvadeUtils.TickCount, isProcessed = false }; //args.ProcessEvent = true; args.ProcessEvent = false; } else { var movePos = args.Position.To2D(); var extraDelay = ObjectCache.menuCache.cache["ExtraPingBuffer"].As <MenuSlider>().Value; if (EvadeHelper.CheckMovePath(movePos, ObjectCache.gamePing + extraDelay)) { /*if (ObjectCache.menuCache.cache["AllowCrossing"].As<MenuBool>().Enabled) * { * var extraDelayBuffer = ObjectCache.menuCache.cache["ExtraPingBuffer"] * .As<MenuSlider>().Value + 30; * var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"] * .As<MenuSlider>().Value + 10; * var tPosInfo = EvadeHelper.CanHeroWalkToPos(movePos, ObjectCache.myHeroCache.moveSpeed, extraDelayBuffer + ObjectCache.gamePing, extraDist); * if (tPosInfo.posDangerLevel == 0) * { * lastPosInfo = tPosInfo; * return; * } * }*/ lastBlockedUserMoveTo = new EvadeCommand { order = EvadeOrderCommand.MoveTo, targetPosition = args /*.Target*/.Position.To2D(), timestamp = EvadeUtils.TickCount, isProcessed = false }; args.ProcessEvent = false; //Block the command // args.ProcessEvent = true; if (EvadeUtils.TickCount - lastMovementBlockTime < 500 && lastMovementBlockPos.Distance(args./*Target.*/ Position) < 100) { return; } lastMovementBlockPos = args./*Target.*/ Position; lastMovementBlockTime = EvadeUtils.TickCount; var posInfo = EvadeHelper.GetBestPositionMovementBlock(movePos); if (posInfo != null) { EvadeCommand.MoveTo(posInfo.position); } return; } lastBlockedUserMoveTo.isProcessed = true; } } else //need more logic { if (isDodging) { args.ProcessEvent = false; //Block the command } else { if (args.OrderType == OrderType.AttackUnit) { var target = args.Target; if (target != null && target.IsValid) { // fix var baseTarget = target as Obj_AI_Base; if (baseTarget != null && ObjectCache.myHeroCache.serverPos2D.Distance(baseTarget.ServerPosition.To2D()) > myHero.AttackRange + ObjectCache.myHeroCache.boundingRadius + baseTarget.BoundingRadius) { var movePos = args /*.Target*/.Position.To2D(); var extraDelay = ObjectCache.menuCache.cache["ExtraPingBuffer"].As <MenuSlider>().Value; if (EvadeHelper.CheckMovePath(movePos, ObjectCache.gamePing + extraDelay)) { args.ProcessEvent = false; //Block the command return; } } } } } } if (args.ProcessEvent) { lastIssueOrderGameTime = Game.ClockTime * 1000; lastIssueOrderTime = EvadeUtils.TickCount; lastIssueOrderArgs = args; if (args.OrderType == OrderType.MoveTo) { lastMoveToPosition = args /*.Target*/.Position.To2D(); lastMoveToServerPos = myHero.ServerPosition.To2D(); } if (args.OrderType == OrderType.Stop) { lastStopPosition = myHero.ServerPosition.To2D(); } } }