private void ContinueLastBlockedCommand() { if (ObjectCache.menuCache.cache["ContinueMovement"].GetValue <bool>() && Situation.ShouldDodge()) { var movePos = lastBlockedUserMoveTo.targetPosition; var extraDelay = ObjectCache.menuCache.cache["ExtraPingBuffer"].GetValue <Slider>().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.NextFloat(1, 65); if (!EvadeHelper.CheckMovePath(movePos, ObjectCache.gamePing + extraDelay)) { //Console.WriteLine("Continue Movement"); //myHero.IssueOrder(GameObjectOrder.MoveTo, movePos.To3D()); EvadeCommand.MoveTo(movePos); lastBlockedUserMoveTo.isProcessed = true; } } } }
private void CheckHeroInDanger() { bool playerInDanger = false; foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells) { Spell spell = entry.Value; if (lastPosInfo != null && lastPosInfo.dodgeableSpells.Contains(spell.spellID) && ObjectCache.myHeroCache.serverPos2D.InSkillShot(spell, ObjectCache.myHeroCache.boundingRadius)) { playerInDanger = true; break; } } if (isDodging && !playerInDanger) { lastDodgingEndTime = EvadeUtils.TickCount; } if (isDodging == false && !Situation.ShouldDodge()) { return; } isDodging = playerInDanger; }
private void Game_OnSendPacket(GamePacketEventArgs args) { if (!Situation.ShouldDodge()) { return; } // Check if the packet sent is a spell cast //Game.PrintChat("" + args.GetPacketId()); if (args != null && args.GetPacketId() == CastSpellPacketID) { //Game.PrintChat("" + Game.Version); if (isDodging && SpellDetector.spells.Count() > 0) { foreach (KeyValuePair <String, SpellData> entry in SpellDetector.windupSpells) { SpellData spellData = entry.Value; if (spellData.spellKey == lastSpellCast) //check if it's a spell that we should block { args.Process = false; return; } } } } }
private void CheckHeroInDanger() { bool playerInDanger = false; foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells) { Spell spell = entry.Value; if (lastPosInfo != null && lastPosInfo.dodgeableSpells.Contains(spell.spellID) && EvadeHelper.InSkillShot(spell, myHero.ServerPosition.To2D(), myHero.BoundingRadius)) { playerInDanger = true; break; } } if (isDodging && !playerInDanger) { lastDodgingEndTime = GetTickCount(); } if (isDodging == false && !Situation.ShouldDodge()) { return; } isDodging = playerInDanger; }
public static void MoveTo(Vector2 movePos) { if (!ObjectCache.menuCache.cache["DodgeSkillShots"].Cast <KeyBind>().CurrentValue) { return; } if (!Situation.ShouldDodge()) { return; } Evade.lastEvadeCommand = new EvadeCommand { order = EvadeOrderCommand.MoveTo, targetPosition = movePos, timestamp = EvadeUtils.TickCount, isProcessed = false }; Evade.lastMoveToPosition = movePos; Evade.lastMoveToServerPos = myHero.ServerPosition.To2D(); Player.IssueOrder(GameObjectOrder.MoveTo, movePos.To3D(), false); }
private void Game_OnCastSpell(Spellbook spellbook, SpellbookCastSpellEventArgs args) { if (!spellbook.Owner.IsMe) { return; } var sData = spellbook.GetSpell(args.Slot); string name; if (SpellDetector.channeledSpells.TryGetValue(sData.Name, out name)) { //Evade.isChanneling = true; //Evade.channelPosition = ObjectCache.myHeroCache.serverPos2D; lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } if (EvadeSpell.lastSpellEvadeCommand != null && EvadeSpell.lastSpellEvadeCommand.timestamp + ObjectCache.gamePing + 150 > EvadeUtils.TickCount) { args.Process = false; } lastSpellCast = args.Slot; lastSpellCastTime = EvadeUtils.TickCount; //moved from processPacket if (Situation.ShouldDodge()) { if (isDodging && SpellDetector.spells.Count() > 0) { foreach (KeyValuePair <String, SpellData> entry in SpellDetector.windupSpells) { SpellData spellData = entry.Value; if (spellData.spellKey == args.Slot) //check if it's a spell that we should block { args.Process = false; return; } } foreach (var evadeSpell in EvadeSpell.evadeSpells) { if (evadeSpell.isItem == false && evadeSpell.spellKey == args.Slot) { lastPosInfo = PositionInfo.SetAllUndodgeable(); if (evadeSpell.evadeType == EvadeType.Blink || evadeSpell.evadeType == EvadeType.Dash) { DelayAction.Add(1, () => EvadeCommand.MoveTo(Game.CursorPos.To2D())); } return; } } } } }
public static void MoveTo(Vector2 movePos) { if (!Situation.ShouldDodge()) { return; } Evade.lastEvadeCommand = new EvadeCommand { order = EvadeOrderCommand.MoveTo, targetPosition = movePos, timestamp = EvadeUtils.TickCount, isProcessed = false }; Evade.lastMoveToPosition = movePos; myHero.IssueOrder(GameObjectOrder.MoveTo, movePos.To3D(), false); }
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 CheckHeroInDanger() { bool playerInDanger = false; foreach (KeyValuePair <int, Spell> entry in SpellDetector.spells) { Spell spell = entry.Value; if (lastPosInfo != null && lastPosInfo.dodgeableSpells.Contains(spell.spellID)) { if (myHero.ServerPosition.To2D().InSkillShot(spell, ObjectCache.myHeroCache.boundingRadius)) { playerInDanger = true; break; } if (ObjectCache.menuCache.cache["EnableEvadeDistance"].GetValue <bool>() && EvadeUtils.TickCount < lastPosInfo.endTime) { playerInDanger = true; break; } } } if (isDodging && !playerInDanger) { lastDodgingEndTime = EvadeUtils.TickCount; } if (isDodging == false && !Situation.ShouldDodge()) { return; } isDodging = playerInDanger; }
private void CheckHeroInDanger() { bool playerInDanger = false; foreach (KeyValuePair <int, Spell> entry in SpellDetector.Spells) { Spell spell = entry.Value; if (LastPosInfo != null) //&& lastPosInfo.dodgeableSpells.Contains(spell.spellID)) { if (GameData.MyHero.ServerPosition.To2D().InSkillShot(spell, GameData.HeroInfo.BoundingRadius)) { playerInDanger = true; break; } if (ConfigValue.EnableEvadeDistance.GetBool() && EvadeUtils.TickCount < LastPosInfo.EndTime) { playerInDanger = true; break; } } } if (IsDodging && !playerInDanger) { LastDodgingEndTime = EvadeUtils.TickCount; } if (IsDodging == false && !Situation.ShouldDodge()) { return; } IsDodging = playerInDanger; }
private void Game_OnIssueOrder(Obj_AI_Base hero, GameObjectIssueOrderEventArgs args) { if (!hero.IsMe) { return; } if (!Situation.ShouldDodge()) { return; } if (args.Order == GameObjectOrder.MoveTo) { //movement block code goes in here if (isDodging && SpellDetector.spells.Count() > 0) { CheckHeroInDanger(); lastBlockedUserMoveTo = new EvadeCommand { order = EvadeOrderCommand.MoveTo, targetPosition = args.TargetPosition.To2D(), timestamp = EvadeUtils.TickCount, isProcessed = false, }; args.Process = false; //Block the command } else { var movePos = args.TargetPosition.To2D(); var extraDelay = ObjectCache.menuCache.cache["ExtraPingBuffer"].GetValue <Slider>().Value; if (EvadeHelper.CheckMovePath(movePos, ObjectCache.gamePing + extraDelay)) { lastBlockedUserMoveTo = new EvadeCommand { order = EvadeOrderCommand.MoveTo, targetPosition = args.TargetPosition.To2D(), timestamp = EvadeUtils.TickCount, isProcessed = false, }; args.Process = false; //Block the command 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 } else { if (args.Order == GameObjectOrder.AttackUnit) { var target = args.Target; if (target != null && target.IsValid <Obj_AI_Base>()) { var baseTarget = target as Obj_AI_Base; if (ObjectCache.myHeroCache.serverPos2D.Distance(baseTarget.ServerPosition.To2D()) > myHero.AttackRange + ObjectCache.myHeroCache.boundingRadius + baseTarget.BoundingRadius) { var movePos = args.TargetPosition.To2D(); var extraDelay = ObjectCache.menuCache.cache["ExtraPingBuffer"].GetValue <Slider>().Value; if (EvadeHelper.CheckMovePath(movePos, ObjectCache.gamePing + extraDelay)) { args.Process = false; //Block the command return; } } } } } } if (args.Process == true) { lastIssueOrderTime = Game.Time * 1000; } }
private void Game_OnIssueOrder(Obj_AI_Base hero, GameObjectIssueOrderEventArgs args) { if (!hero.IsMe) { return; } if (!Situation.ShouldDodge()) { return; } if (args.Order == GameObjectOrder.MoveTo) { //movement block code goes in here if (isDodging && SpellDetector.spells.Count() > 0) { CheckHeroInDanger(); lastBlockedUserMoveTo = new EvadeCommand { order = EvadeOrderCommand.MoveTo, targetPosition = args.TargetPosition.To2D(), timestamp = GetTickCount(), isProcessed = false, }; args.Process = false; //Block the command } else { var movePos = args.TargetPosition.To2D(); var extraDelay = Evade.menu.SubMenu("MiscSettings").SubMenu("ExtraBuffers").Item("ExtraPingBuffer").GetValue <Slider>().Value; if (EvadeHelper.CheckMovePath(movePos, Game.Ping + extraDelay)) { args.Process = false; //Block the command if (GetTickCount() - lastMovementBlockTime < 250 && lastMovementBlockPos.Distance(args.TargetPosition) < 100) { return; } lastMovementBlockPos = args.TargetPosition; lastMovementBlockTime = GetTickCount(); var posInfo = EvadeHelper.GetBestPositionMovementBlock(movePos); if (posInfo != null) { EvadeCommand.MoveTo(posInfo.position); } return; } } } else //need more logic { if (isDodging) { args.Process = false; //Block the command } } }
private void DodgeSkillShots() { if (!Situation.ShouldDodge()) { isDodging = false; return; } /* * if (isDodging && playerInDanger == false) //serverpos test * { * myHero.IssueOrder(GameObjectOrder.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)); * }*/ Vector2 lastBestPosition = lastPosInfo.position; if (ObjectCache.menuCache.cache["RecalculatePosition"].GetValue <bool>())//recheck path { var dodgeInterval = ObjectCache.menuCache.cache["DodgeInterval"].GetValue <Slider>().Value; if (lastPosInfo != null && !lastPosInfo.recalculatedPath && dodgeInterval <= EvadeUtils.TickCount - lastPosInfo.timestamp) { var path = myHero.Path; if (path.Length > 0) { var movePos = path[path.Length - 1].To2D(); if (movePos.Distance(lastPosInfo.position) < 5) //more strict checking { var posInfo = EvadeHelper.CanHeroWalkToPos(movePos, ObjectCache.myHeroCache.moveSpeed, 0, 0, false); if (posInfo.isSamePosInfo(lastPosInfo) && posInfo.posDangerCount > lastPosInfo.posDangerCount) { var newPosInfo = EvadeHelper.GetBestPosition(); if (newPosInfo.posDangerCount < posInfo.posDangerCount) { lastPosInfo = newPosInfo; CheckHeroInDanger(); } else if (EvadeSpell.PreferEvadeSpell()) { lastPosInfo = PositionInfo.SetAllUndodgeable(); } else { lastPosInfo.recalculatedPath = true; } } } } } } EvadeCommand.MoveTo(lastBestPosition); if (Game.Time * 1000 - lastIssueOrderTime < 1) { DelayAction.Add(0, () => EvadeCommand.MoveTo(lastBestPosition)); } } } else //if not dodging { //return; //Check if hero will walk into a skillshot var path = myHero.Path; if (path.Length > 0) { var movePos = path[path.Length - 1].To2D(); if (EvadeHelper.CheckMovePath(movePos)) { var posInfo = EvadeHelper.GetBestPositionMovementBlock(movePos); if (posInfo != null) { EvadeCommand.MoveTo(posInfo.position); if (Game.Time * 1000 - lastIssueOrderTime < 1) { DelayAction.Add(0, () => EvadeCommand.MoveTo(posInfo.position)); } } return; } } } }
private void DodgeSkillShots() { if (!Situation.ShouldDodge()) { isDodging = false; return; } /* * if (isDodging && playerInDanger == false) //serverpos test * { * myHero.IssueOrder(GameObjectOrder.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)); * }*/ Vector2 lastBestPosition = lastPosInfo.position; if (ObjectCache.menuCache.cache["ClickOnlyOnce"].GetValue <bool>() == false || !(myHero.Path.Count() > 0 && lastPosInfo.position.Distance(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 = myHero.Path; if (path.Length > 0) { var movePos = path[path.Length - 1].To2D(); if (EvadeHelper.CheckMovePath(movePos)) { /*if (ObjectCache.menuCache.cache["AllowCrossing"].GetValue<bool>()) * { * var extraDelayBuffer = ObjectCache.menuCache.cache["ExtraPingBuffer"] * .GetValue<Slider>().Value + 30; * var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"] * .GetValue<Slider>().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); } 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 Game_OnIssueOrder(Obj_AI_Base hero, PlayerIssueOrderEventArgs args) { if (!hero.IsMe) { return; } if (!Situation.ShouldDodge()) { return; } if (args.Order == GameObjectOrder.MoveTo) { if (isDodging && SpellDetector.spells.Any()) { CheckHeroInDanger(); lastBlockedUserMoveTo = new EvadeCommand { order = EvadeOrderCommand.MoveTo, targetPosition = args.TargetPosition.To2D(), timestamp = EvadeUtils.TickCount, isProcessed = false, }; args.Process = false; } else { var movePos = args.TargetPosition.To2D(); var extraDelay = ObjectCache.menuCache.cache["ExtraPingBuffer"].GetValue <Slider>().Value; if (EvadeHelper.CheckMovePath(movePos, ObjectCache.gamePing + extraDelay)) { /*if (ObjectCache.menuCache.cache["AllowCrossing"].GetValue<bool>()) * { * var extraDelayBuffer = ObjectCache.menuCache.cache["ExtraPingBuffer"] * .GetValue<Slider>().Value + 30; * var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"] * .GetValue<Slider>().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.TargetPosition.To2D(), timestamp = EvadeUtils.TickCount, isProcessed = false, }; args.Process = false; //Block the command 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 } else { if (args.Order == GameObjectOrder.AttackUnit) { var target = args.Target; if (target != null && target.IsValid <Obj_AI_Base>()) { var baseTarget = target as Obj_AI_Base; if (ObjectCache.myHeroCache.serverPos2D.Distance(baseTarget.ServerPosition.To2D()) > myHero.AttackRange + ObjectCache.myHeroCache.boundingRadius + baseTarget.BoundingRadius) { var movePos = args.TargetPosition.To2D(); var extraDelay = ObjectCache.menuCache.cache["ExtraPingBuffer"].GetValue <Slider>().Value; if (EvadeHelper.CheckMovePath(movePos, ObjectCache.gamePing + extraDelay)) { args.Process = false; //Block the command return; } } } } } } if (args.Process == true) { lastIssueOrderGameTime = Game.Time * 1000; lastIssueOrderTime = EvadeUtils.TickCount; lastIssueOrderArgs = args; if (args.Order == GameObjectOrder.MoveTo) { lastMoveToPosition = args.TargetPosition.To2D(); lastMoveToServerPos = myHero.ServerPosition.To2D(); } if (args.Order == GameObjectOrder.Stop) { lastStopPosition = myHero.ServerPosition.To2D(); } } }
private void Game_OnCastSpell(Spellbook spellbook, SpellbookCastSpellEventArgs args) /////LOI DOAN NAY { if (!spellbook.Owner.IsMe) { return; } var sData = spellbook.GetSpell(args.Slot); string name; if (SpellDetector.channeledSpells.TryGetValue(sData.Name, out name)) { //Evade.isChanneling = true; //Evade.channelPosition = ObjectCache.myHeroCache.serverPos2D; lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } //block spell commmands if evade spell just used if (EvadeSpell.lastSpellEvadeCommand != null && EvadeSpell.lastSpellEvadeCommand.timestamp + ObjectCache.gamePing + 150 > EvadeUtils.TickCount) { args.Process = false; } lastSpellCast = args.Slot; lastSpellCastTime = EvadeUtils.TickCount; //moved from processPacket /*if (args.Slot == SpellSlot.Recall) * { * lastStopPosition = myHero.ServerPosition.To2D(); * }*/ if (Situation.ShouldDodge()) { if (isDodging && SpellDetector.spells.Any()) { foreach (KeyValuePair <String, SpellData> entry in SpellDetector.windupSpells) { SpellData spellData = entry.Value; if (spellData.spellKey == args.Slot) //check if it's a spell that we should block { args.Process = false; return; } } } } foreach (var evadeSpell in EvadeSpell.evadeSpells) { if (evadeSpell.isItem == false && evadeSpell.spellKey == args.Slot && evadeSpell.untargetable == false) { if (evadeSpell.evadeType == EvadeType.Blink) { var dir = (args.StartPosition.To2D() - myHero.ServerPosition.To2D()).Normalized(); var end = myHero.ServerPosition.To2D() + dir * myHero.ServerPosition.To2D().Distance(Game.CursorPos.To2D()); if (evadeSpell.fixedRange || end.Distance(myHero.ServerPosition.To2D()) > evadeSpell.range) { end = myHero.ServerPosition.To2D() + dir * evadeSpell.range; } var posInfo = EvadeHelper.CanHeroWalkToPos(end, evadeSpell.speed, ObjectCache.gamePing, 0); if (posInfo.posDangerCount < 1) { if (lastPosInfo != null) { lastPosInfo = posInfo; } if (lastPosInfo == null) { lastPosInfo = posInfo; } if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 250) { EvadeCommand.MoveTo(Game.CursorPos.To2D()); lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } return; } } if (evadeSpell.evadeType == EvadeType.Dash) { var dashPos = args.StartPosition.To2D(); if (args.Target != null) { dashPos = args.Target.Position.To2D(); } if (evadeSpell.fixedRange || dashPos.Distance(myHero.ServerPosition.To2D()) > evadeSpell.range) { var dir = (dashPos - myHero.ServerPosition.To2D()).Normalized(); dashPos = myHero.ServerPosition.To2D() + dir * evadeSpell.range; } var posInfo = EvadeHelper.CanHeroWalkToPos(dashPos, evadeSpell.speed, ObjectCache.gamePing, 0); if (posInfo.posDangerLevel > 0) { args.Process = false; } else { if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 500) { EvadeCommand.MoveTo(Game.CursorPos.To2D()); lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } return; } } lastPosInfo = PositionInfo.SetAllUndodgeable(); return; } } }
private void Game_OnCastSpell(Spellbook spellbook, SpellbookCastSpellEventArgs args) { if (!spellbook.Owner.IsMe) { return; } var sData = spellbook.GetSpell(args.Slot); string name; if (SpellDetector.channeledSpells.TryGetValue(sData.Name, out name)) { //Evade.isChanneling = true; //Evade.channelPosition = ObjectCache.myHeroCache.serverPos2D; lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } if (EvadeSpell.lastSpellEvadeCommand != null && EvadeSpell.lastSpellEvadeCommand.timestamp + ObjectCache.gamePing + 150 > EvadeUtils.TickCount) { args.Process = false; } lastSpellCast = args.Slot; lastSpellCastTime = EvadeUtils.TickCount; //moved from processPacket /*if (args.Slot == SpellSlot.Recall) * { * lastStopPosition = myHero.ServerPosition.To2D(); * }*/ if (Situation.ShouldDodge()) { if (isDodging && SpellDetector.spells.Count() > 0) { foreach (KeyValuePair <String, SpellData> entry in SpellDetector.windupSpells) { SpellData spellData = entry.Value; if (spellData.spellKey == args.Slot) //check if it's a spell that we should block { args.Process = false; return; } } } } foreach (var evadeSpell in EvadeSpell.evadeSpells) { if (evadeSpell.isItem == false && evadeSpell.spellKey == args.Slot) { if (evadeSpell.evadeType == EvadeType.Blink || evadeSpell.evadeType == EvadeType.Dash) { //Block spell cast if flashing/blinking into spells if (args.EndPosition.To2D().CheckDangerousPos(6, true)) //for blink + dash { args.Process = false; return; } if (evadeSpell.evadeType == EvadeType.Dash) { var extraDelayBuffer = ObjectCache.menuCache.cache["ExtraPingBuffer"].Cast <Slider>().CurrentValue; var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"].Cast <Slider>().CurrentValue; var dashPos = Game.CursorPos.To2D(); //real pos? if (evadeSpell.fixedRange) { var dir = (dashPos - myHero.ServerPosition.To2D()).Normalized(); dashPos = myHero.ServerPosition.To2D() + dir * evadeSpell.range; } //Draw.RenderObjects.Add(new Draw.RenderPosition(dashPos, 1000)); var posInfo = EvadeHelper.CanHeroWalkToPos(dashPos, evadeSpell.speed, extraDelayBuffer + ObjectCache.gamePing, extraDist); if (posInfo.posDangerLevel > 0) { args.Process = false; return; } } lastPosInfo = PositionInfo.SetAllUndodgeable(); //really? if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 500) { EvadeCommand.MoveTo(Game.CursorPos.To2D()); //block moveto lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } } return; } } }
private void Game_OnCastSpell(Spellbook spellbook, SpellbookCastSpellEventArgs args) { if (!spellbook.Owner.IsMe) { return; } var sData = spellbook.GetSpell(args.Slot); string name; if (SpellDetector.channeledSpells.TryGetValue(sData.Name, out name)) { lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } //block spell commmands if evade spell just used if (EvadeSpell.lastSpellEvadeCommand != null && EvadeSpell.lastSpellEvadeCommand.timestamp + ObjectCache.gamePing + 150 > EvadeUtils.TickCount) { args.Process = false; } lastSpellCast = args.Slot; lastSpellCastTime = EvadeUtils.TickCount; if (Situation.ShouldDodge()) { if (isDodging && SpellDetector.spells.Count() > 0) { foreach (KeyValuePair <String, SpellData> entry in SpellDetector.windupSpells) { SpellData spellData = entry.Value; if (spellData.spellKey == args.Slot) //check if it's a spell that we should block { args.Process = false; return; } } } } foreach (var evadeSpell in EvadeSpell.evadeSpells) { if (evadeSpell.isItem == false && evadeSpell.spellKey == args.Slot && evadeSpell.untargetable == false) { if (evadeSpell.evadeType == EvadeType.Dash) { if (evadeSpell.evadeType == EvadeType.Dash) { var dashPos = args.StartPosition.LSTo2D(); //real pos? if (args.Target != null) { dashPos = args.Target.Position.LSTo2D(); } if (evadeSpell.fixedRange || dashPos.LSDistance(myHero.ServerPosition.LSTo2D()) > evadeSpell.range) { var dir = (dashPos - myHero.ServerPosition.LSTo2D()).LSNormalized(); dashPos = myHero.ServerPosition.LSTo2D() + dir * evadeSpell.range; } var posInfo = EvadeHelper.CanHeroWalkToPos(dashPos, evadeSpell.speed, ObjectCache.gamePing, 0); if (posInfo.posDangerLevel > 0) { args.Process = false; return; } } lastPosInfo = PositionInfo.SetAllUndodgeable(); if (isDodging || EvadeUtils.TickCount < lastDodgingEndTime + 500) { EvadeCommand.MoveTo(Game.CursorPos.LSTo2D()); lastStopEvadeTime = EvadeUtils.TickCount + ObjectCache.gamePing + 100; } } return; } } }
private void DodgeSkillShots() { if (!Situation.ShouldDodge()) { isDodging = false; return; } /* * if (isDodging && playerInDanger == false) //serverpos test * { * myHero.IssueOrder(GameObjectOrder.HoldPosition, myHero, false); * }*/ if (isDodging) { if (lastPosInfo != null) { /*foreach (KeyValuePair<int, Spell> entry in SpellDetector.spells) * { * Spell spell = entry.Value; * * Game.PrintChat("" + (int)(GetTickCount()-spell.startTime)); * }*/ Vector2 lastBestPosition = lastPosInfo.position; if (menu.SubMenu("MiscSettings").Item("RecalculatePosition").GetValue <bool>())//recheck path { var path = myHero.Path; if (path.Length > 0) { var movePos = path[path.Length - 1].To2D(); if (movePos.Distance(lastPosInfo.position) < 5) //more strict checking { var posInfo = EvadeHelper.CanHeroWalkToPos(movePos, myHero.MoveSpeed, 0, 0, false); if (EvadeHelper.isSamePosInfo(posInfo, lastPosInfo) && posInfo.posDangerCount > lastPosInfo.posDangerCount) { var newPosInfo = EvadeHelper.GetBestPosition(); if (newPosInfo.posDangerCount < posInfo.posDangerCount) { lastPosInfo = newPosInfo; CheckHeroInDanger(); } else if (EvadeSpell.PreferEvadeSpell()) { lastPosInfo = EvadeHelper.SetAllUndodgeable(); EvadeSpell.UseEvadeSpell(); //using spells) } } } } } EvadeCommand.MoveTo(lastBestPosition); } } else //if not dodging { //Check if hero will walk into a skillshot var path = myHero.Path; if (path.Length > 0) { var movePos = path[path.Length - 1].To2D(); if (EvadeHelper.CheckMovePath(movePos)) { var posInfo = EvadeHelper.GetBestPositionMovementBlock(movePos); if (posInfo != null) { EvadeCommand.MoveTo(posInfo.position); } return; } } } }
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 Ka", 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; } } } }