private void SpellDetector_OnProcessDetectedSpells() { GameData.HeroInfo.UpdateInfo(); if (!ConfigValue.DodgeSkillShots.GetBool()) { LastPosInfo = PositionInfo.SetAllUndodgeable(); EvadeSpell.UseEvadeSpell(); return; } if (GameData.HeroInfo.ServerPos2D.CheckDangerousPos(0) || GameData.HeroInfo.ServerPos2DExtra.CheckDangerousPos(0)) { if (EvadeSpell.PreferEvadeSpell()) { LastPosInfo = PositionInfo.SetAllUndodgeable(); } else { var calculationTimer = EvadeUtils.TickCount; var posInfo = EvadeHelper.GetBestPosition(); var caculationTime = EvadeUtils.TickCount - calculationTimer; if (NumCalculationTime > 0) { SumCalculationTime += caculationTime; AvgCalculationTime = SumCalculationTime / NumCalculationTime; } NumCalculationTime += 1; //ConsoleDebug.WriteLine("CalculationTime: " + caculationTime); /*if (EvadeHelper.GetHighestDetectedSpellID() > EvadeHelper.GetHighestSpellID(posInfo)) * { * return; * }*/ if (posInfo != null) { LastPosInfo = posInfo.CompareLastMovePos(); var travelTime = GameData.HeroInfo.ServerPos2DPing.Distance(LastPosInfo.Position) / GameData.MyHero.MoveSpeed; LastPosInfo.EndTime = EvadeUtils.TickCount + travelTime * 1000 - 100; } CheckHeroInDanger(); DodgeSkillShots(); //walking CheckLastMoveTo(); EvadeSpell.UseEvadeSpell(); //using spells } } else { LastPosInfo = PositionInfo.SetAllDodgeable(); CheckLastMoveTo(); } //ConsoleDebug.WriteLine("SkillsDodged: " + lastPosInfo.dodgeableSpells.Count + " DangerLevel: " + lastPosInfo.undodgeableSpells.Count); }
private void RecalculatePath() { if (!ObjectCache.MenuCache.Cache["RecalculatePosition"].As <MenuBool>().Enabled || !IsDodging) { return; } if (LastPosInfo == null || LastPosInfo.RecalculatedPath) { return; } var path = MyHero.Path; if (path.Length <= 0) { return; } var movePos = path.Last().To2D(); if (!(movePos.Distance(LastPosInfo.Position) < 5)) { return; } var posInfo = EvadeHelper.CanHeroWalkToPos(movePos, ObjectCache.MyHeroCache.MoveSpeed, 0, 0, false); if (posInfo.PosDangerCount <= LastPosInfo.PosDangerCount) { return; } LastPosInfo.RecalculatedPath = true; if (EvadeSpell.PreferEvadeSpell()) { LastPosInfo = PositionInfo.SetAllUndodgeable(); } else { var newPosInfo = EvadeHelper.GetBestPosition(); if (newPosInfo.PosDangerCount >= posInfo.PosDangerCount) { return; } LastPosInfo = newPosInfo; CheckHeroInDanger(); DodgeSkillShots(); } }
private void SpellDetector_OnProcessDetectedSpells() { ObjectCache.MyHeroCache.UpdateInfo(); if (!ObjectCache.MenuCache.Cache["DodgeSkillShots"].As <MenuKeyBind>().Enabled) { LastPosInfo = PositionInfo.SetAllUndodgeable(); EvadeSpell.UseEvadeSpell(); return; } if (ObjectCache.MyHeroCache.ServerPos2D.CheckDangerousPos(0) || ObjectCache.MyHeroCache.ServerPos2DExtra.CheckDangerousPos(0)) { if (EvadeSpell.PreferEvadeSpell()) { LastPosInfo = PositionInfo.SetAllUndodgeable(); } else { var posInfo = EvadeHelper.GetBestPosition(); if (posInfo != null) { LastPosInfo = posInfo.CompareLastMovePos(); var travelTime = ObjectCache.MyHeroCache.ServerPos2DPing.Distance(LastPosInfo.Position) / MyHero.MoveSpeed; LastPosInfo.EndTime = Environment.TickCount + travelTime * 1000 - 100; } CheckHeroInDanger(); if (Environment.TickCount > LastStopEvadeTime) { DodgeSkillShots(); } CheckLastMoveTo(); EvadeSpell.UseEvadeSpell(); } } else { LastPosInfo = PositionInfo.SetAllDodgeable(); CheckLastMoveTo(); } }
private void RecalculatePath() { if (ConfigValue.RecalculatePath.GetBool() && IsDodging) //recheck path { if (LastPosInfo != null && !LastPosInfo.RecalculatedPath) { var path = GameData.MyHero.Path; if (path.Length > 0) { var movePos = path.Last().To2D(); if (movePos.Distance(LastPosInfo.Position) < 5) //more strict checking { var posInfo = EvadeHelper.CanHeroWalkToPos(movePos, GameData.HeroInfo.MoveSpeed, 0, 0, false); if (posInfo.PosDangerCount > LastPosInfo.PosDangerCount) { LastPosInfo.RecalculatedPath = true; if (EvadeSpell.PreferEvadeSpell()) { LastPosInfo = PositionInfo.SetAllUndodgeable(); } else { var newPosInfo = EvadeHelper.GetBestPosition(); if (newPosInfo.PosDangerCount < posInfo.PosDangerCount) { LastPosInfo = newPosInfo; CheckHeroInDanger(); DodgeSkillShots(); } } } } } } } }