private void RecalculatePath() { if (ObjectCache.menuCache.cache["RecalculatePosition"].As <MenuBool>().Enabled&& isDodging) //recheck path { if (lastPosInfo != null && !lastPosInfo.recalculatedPath) { var path = 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, ObjectCache.myHeroCache.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(); } } } } } } } }
private void SpellDetector_OnProcessDetectedSpells() { ObjectCache.myHeroCache.UpdateInfo(); if (ObjectCache.menuCache.cache["DodgeSkillShots"].As <MenuKeyBind>().Enabled == false) { 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(); var calculationTimer = EvadeUtils.TickCount; var caculationTime = EvadeUtils.TickCount - calculationTimer; //computing time /*if (numCalculationTime > 0) * { * sumCalculationTime += caculationTime; * avgCalculationTime = sumCalculationTime / numCalculationTime; * } * numCalculationTime += 1;*/ //Console.WriteLine("CalculationTime: " + caculationTime); /*if (EvadeHelper.GetHighestDetectedSpellID() > EvadeHelper.GetHighestSpellID(posInfo)) * { * return; * }*/ if (posInfo != null) { lastPosInfo = posInfo.CompareLastMovePos(); var travelTime = ObjectCache.myHeroCache.serverPos2DPing.Distance(lastPosInfo.position) / myHero.MoveSpeed; lastPosInfo.endTime = EvadeUtils.TickCount + travelTime * 1000 - 100; } CheckHeroInDanger(); if (EvadeUtils.TickCount > lastStopEvadeTime) { DodgeSkillShots(); //walking } CheckLastMoveTo(); EvadeSpell.UseEvadeSpell(); //using spells } } else { lastPosInfo = PositionInfo.SetAllDodgeable(); CheckLastMoveTo(); } //Console.WriteLine("SkillsDodged: " + lastPosInfo.dodgeableSpells.Count + " DangerLevel: " + lastPosInfo.undodgeableSpells.Count); }