private void OnModifierAdded(Unit sender, ModifierChangedEventArgs args) { if (sender.Handle != manager.MyHero.Handle) { return; } var modifier = ModifierUtils.DelayPowerTreadsSwitchModifiers.FirstOrDefault(x => x == args.Modifier.Name); if (!string.IsNullOrEmpty(modifier)) { activeDelaySwitchModifiers.Add(modifier); if (sleeper.Sleeping(AbilityId) || recoveryMenu.IsActive) { return; } switch (modifier) { case "modifier_item_urn_heal": case "modifier_flask_healing": case "modifier_filler_heal": case "modifier_bottle_regeneration": { powerTreads.SwitchTo(Attribute.Agility); break; } } } }
public static async void OnUpdate(EventArgs args) { if (!IsEnable) { return; } if (!Members.MyHero.IsAlive) { return; } if (_attacker == null) { _attacker = new Sleeper(); } if (_spellSleeper == null) { _spellSleeper = new MultiSleeper(); } if (_ethereal == null) { _ethereal = new Sleeper(); } if (_laser == null) { _laser = Abilities.FindAbility("tinker_laser"); } if (_rockets == null) { _rockets = Abilities.FindAbility("tinker_heat_seeking_missile"); } if (_spellSleeper.Sleeping(Abilities.FindAbility("tinker_rearm"))) { return; } if (_testCombo != null && !_testCombo.IsCompleted) { return; } _tks = new CancellationTokenSource(); _testCombo = Action(_tks.Token); try { await _testCombo; _testCombo = null; } catch (OperationCanceledException) { _testCombo = null; } if (IsEnableKillSteal && !IsComboHero) { foreach (var x in Heroes.GetByTeam(Members.MyHero.GetEnemyTeam()) .Where(x => x.IsAlive && x.IsVisible && !x.IsIllusion() && !x.IsMagicImmune()) .Where(x => Helper.CalculateMyCurrentDamage(x, true) < 0)) { await DoTrash(x, CancellationToken.None, true); } } }
public async Task UseAbilities(UnitBase unitBase) { if (unitBase.Hero.IsInvisible() || unitBase.Hero.Modifiers.Any(x => x.Name.Contains("windwalk"))) { return; } var flux = unitBase.Flux; var magneticField = unitBase.MagneticField; var spark = unitBase.Spark; if (!_multiSleeper.Sleeping(flux) && unitBase.AbilityChecker.IsAbilityEnabled(flux.GetAbilityId()) && flux.CanBeCasted() && flux.CanHit(Core.Target)) { if (Core.Target.IsLinkensProtected() || !MenuManager.SmartFlux || !EntityManager <Unit> .Entities.Any( x => !x.Equals(Core.Target) && x.Team == Core.Target.Team && x.Name != "npc_dota_thinker" && x.IsAlive && x.IsVisible && Ensage.SDK.Extensions.EntityExtensions.Distance2D(x, Core.Target) <= 225)) { flux.UseAbility(Core.Target); Printer.Both("Flux usages " + flux.GetAbilityDelay()); _multiSleeper.Sleep(500, flux); await Task.Delay(flux.GetAbilityDelay(), Core.ComboToken.Token); } } var distance = unitBase.Hero.Distance2D(Core.Target); if (!_multiSleeper.Sleeping(magneticField) && magneticField != null && unitBase.AbilityChecker.IsAbilityEnabled(magneticField.GetAbilityId()) && magneticField.CanBeCasted() && !unitBase.Hero.HasModifier("modifier_arc_warden_magnetic_field") && distance <= 600 && Core.Target.IsVisible) { if (!MenuManager.MagneticField && Core.Target.IsMelee) { magneticField.UseAbility(Prediction.InFront(unitBase.Hero, -250)); } else { magneticField.UseAbility(Prediction.InFront(unitBase.Hero, 250)); } _multiSleeper.Sleep(500, magneticField); Printer.Both("MagneticField usages"); await Task.Delay(magneticField.GetAbilityDelay(), Core.ComboToken.Token); } if (!_multiSleeper.Sleeping(spark) && spark != null && unitBase.AbilityChecker.IsAbilityEnabled(spark.GetAbilityId()) && spark.CanBeCasted() && !Prediction.IsTurning(Core.Target) && unitBase.Hero.IsVisibleToEnemies) { if (UnitExtensions.IsInAttackRange(unitBase.Hero, Core.Target) && MenuManager.SmartSpark) { return; } var delay = spark.GetAbilityDelay(); var predVector3 = Prediction.PredictedXYZ(Core.Target, 2000 + delay); spark.UseAbility(predVector3); _multiSleeper.Sleep(500, spark); Printer.Both("spark usages"); await Task.Delay(spark.GetAbilityDelay(), Core.ComboToken.Token); } }
private static void CastCombo() { var distance = Members.MyHero.Distance2D(GlobalTarget); if (CastItems(distance) && !_spellSleeper.Sleeping("daggerTime")) { CastAbilities(distance); } }
private void OnUpdate(EventArgs args) { if (!Game.IsInGame || Game.IsPaused || !Menu.ArmletAutoToggle) { return; } if (!Hero.IsAlive || !Hero.CanUseItems()) { return; } var nearEnemies = ObjectManager.GetEntitiesParallel <Unit>() .Where( x => x.IsValid && x.IsAlive && x.IsSpawned && x.AttackCapability != AttackCapability.None && x.Team != HeroTeam && x.Distance2D(Hero) < x.GetAttackRange() + 200); foreach (var enemy in nearEnemies.Where(x => x.AttackCapability == AttackCapability.Melee)) { if (enemy.IsAttacking() && !attackStart.Sleeping(enemy)) { attacking.Sleep((float)UnitDatabase.GetAttackPoint(enemy) * 1000, enemy); attackStart.Sleep(enemy.AttacksPerSecond * 1000 - Game.Ping, enemy); } else if (!enemy.IsAttacking() && attackStart.Sleeping(enemy)) { attackStart.Reset(enemy); attacking.Sleep((float)UnitDatabase.GetAttackBackswing(enemy) * 1000, enemy); } } if (Sleeper.Sleeping) { return; } var heroProjectiles = ObjectManager.TrackingProjectiles.Where(x => x?.Target is Hero && x.Target.Equals(Hero)).ToList(); var noProjectile = heroProjectiles.All( x => x.Position.Distance2D(Hero) / x.Speed > 0.30 || x.Position.Distance2D(Hero) / x.Speed < Game.Ping / 1000); var noAutoAttack = nearEnemies.All(x => x.FindRelativeAngle(Hero.Position) > 0.5 || !attacking.Sleeping(x)); if (Hero.Health < Menu.ArmetHpThreshold && noProjectile && noAutoAttack && (nearEnemies.Any() || heroProjectiles.Any())) { Use(null, null); } }
private static async Task Action(CancellationToken cancellationToken) { var target = ShackleshotCalculation.Target; if (target == null) { return; } await UseBlink(target, cancellationToken); //await UseAbility(new Ability(), Target, cancellationToken); var inventory = Members.MyHero.Inventory.Items.Where(x => x.CanBeCasted() && x.CanHit(target)); var enumerable = inventory as Item[] ?? inventory.ToArray(); var linkerBreakers = enumerable.Where( x => Helper.IsItemEnable(x, false) && target.IsLinkensProtected() && !ComboSleeper.Sleeping(x)); foreach (var item in linkerBreakers) { await UseItem(item, target, cancellationToken); } var itemInCombo = enumerable.Where( x => Helper.IsItemEnable(x) && !target.IsLinkensProtected() && !ComboSleeper.Sleeping(x)); foreach (var item in itemInCombo) { await UseItem(item, target, cancellationToken); } /*var myItem = inventory.FirstOrDefault(); * if (myItem != null) * { * await UseItem(myItem, target, cancellationToken); * }*/ if (OrbEnable && (!target.IsStunned() || !OrbInStun)) { Orbwalking.Orbwalk(target, followTarget: OrbFollow); } else if (Utils.SleepCheck("attack_rate")) { if (!Members.MyHero.IsAttacking()) { Members.MyHero.Attack(target); Utils.Sleep(125, "attack_rate"); } } }
private void OnUpdate() { if (Game.IsPaused || !manager.MyHero.IsAlive) { return; } var canUseItems = manager.MyHero.CanUseItems(); var canUseAbilities = manager.MyHero.CanUseAbilities(); foreach (var offensiveAbility in offensiveAbilities .Where( x => menu.IsAbilityEnabled(x.Name) && x.CanBeCasted() && (x.IsItem ? canUseItems : canUseAbilities)) .OrderByDescending(x => menu.GetPriority(x.Name))) { var target = manager.MyHero.Target; if (!offensiveAbility.CanBeCasted(target) || sleeper.Sleeping(target) || !menu.IsHeroEnabled(target.StoredName())) { target = null; } if (offensiveAbility.Menu.AlwaysUse && target == null) { target = EntityManager <Hero> .Entities .Where( x => x.IsValid && !sleeper.Sleeping(x) && x.Team != manager.MyHero.Team && menu.IsHeroEnabled(x.StoredName()) && !x.IsIllusion) .OrderBy(x => manager.MyHero.Hero.FindRotationAngle(x.Position)) .FirstOrDefault(x => offensiveAbility.CanBeCasted(x)); } if (target == null) { return; } DelayAction.Add( offensiveAbility.Menu.Delay, () => { if (!offensiveAbility.CanBeCasted() || !offensiveAbility.CanBeCasted(target)) { return; } offensiveAbility.Use(target); }); sleeper.Sleep(Math.Max(500, offensiveAbility.Menu.Delay), target); } }
private void OnExecuteOrder(Player sender, ExecuteOrderEventArgs args) { if (!args.Entities.Contains(manager.MyHero.Hero) || !args.IsPlayerInput) { return; } if (menu.IsActive || (sleeper.Sleeping("pickingItems") || sleeper.Sleeping("blockEarlyKeyRelease")) && args.OrderId != OrderId.PickItem && args.OrderId != OrderId.MoveItem) { args.Process = false; } }
public void OnUpdate() { if (sleeper.Sleeping(this)) { return; } if (!sleeper.Sleeping(enemyHeroes)) { foreach (var enemy in Ensage.Common.Objects.Heroes.GetByTeam(enemyTeam) .Where(x => x.IsValid && !x.IsIllusion && !enemyHeroes.Exists(z => z.Handle == x.Handle))) { enemyHeroes.Add(new EnemyHero(enemy)); } sleeper.Sleep(2000, enemyHeroes); } foreach (var enemy in enemyHeroes) { if (!enemy.IsVisible) { enemy.ObserversCount = 0; enemy.SentryCount = 0; continue; } if (PlacedWard(enemy, ClassId.CDOTA_Item_ObserverWard)) { AddWard <ObserverWard>(enemy); } if (PlacedWard(enemy, ClassId.CDOTA_Item_SentryWard)) { AddWard <SentryWard>(enemy); } } if (!sleeper.Sleeping(units)) { var removeUnits = units.Where(x => x.Duration > 0 && x.EndTime <= Game.RawGameTime).ToList(); if (removeUnits.Any()) { removeUnits.ForEach(x => x.ParticleEffect?.Dispose()); units.RemoveAll(x => removeUnits.Contains(x)); } sleeper.Sleep(1000, units); } sleeper.Sleep(100, this); }
private void OnUpdate() { if (sleeper.Sleeping(this) || Game.IsPaused) { return; } sleeper.Sleep(menu.UpdateRate, this); var validControllables = controllables.Where(x => x.IsValid()).ToList(); if (menu.ToggleKey && menu.EnabledToggleItems.Contains(0) || menu.HoldKey && menu.EnabledHoldItems.Contains(0)) { var runes = ObjectManager.GetEntitiesParallel <Rune>() .Where(x => !sleeper.Sleeping(x.Handle) && x.IsVisible); foreach (var rune in runes) { foreach (var controllable in validControllables) { if (controllable.CanPick(rune)) { controllable.Pick(rune); sleeper.Sleep(500, rune.Handle); break; } } } } var items = ObjectManager.GetEntitiesParallel <PhysicalItem>() .Where( x => x.IsVisible && !ignoredItems.Contains(x.Item.Handle) && !sleeper.Sleeping(x.Handle) && (menu.ToggleKey && menu.EnabledToggleItems.Contains(x.Item.Id) || menu.HoldKey && menu.EnabledHoldItems.Contains(x.Item.Id))); foreach (var item in items) { foreach (var controllable in validControllables) { if (controllable.CanPick(item, menu.ItemMoveCostThreshold)) { controllable.Pick(item); sleeper.Sleep(500, item.Handle); break; } } } }
private void OnUpdate() { if (Game.IsPaused) { return; } var validControllables = controllables.Where(x => x.IsValid()).ToList(); if (menu.ToggleKey && menu.EnabledToggleItems.Contains(0) || menu.HoldKey && menu.EnabledHoldItems.Contains(0)) { //var runes = EntityManager<Rune>.Entities var runes = ObjectManager.GetEntitiesFast <Rune>().Where(x => !sleeper.Sleeping(x.Handle)); foreach (var rune in runes) { foreach (var controllable in validControllables) { if (controllable.CanPick(rune)) { controllable.Pick(rune); sleeper.Sleep(500, rune.Handle); break; } } } } var items = EntityManager <PhysicalItem> .Entities.Where( x => x.IsValid && x.IsVisible && !ignoredItems.Contains(x.Item.Handle) && !sleeper.Sleeping(x.Handle) && (menu.ToggleKey && menu.EnabledToggleItems.Contains(x.Item.Id) || menu.HoldKey && menu.EnabledHoldItems.Contains(x.Item.Id))) .OrderByDescending(x => x.Item.Id == AbilityId.item_aegis); foreach (var item in items) { foreach (var controllable in validControllables) { if (controllable.CanPick(item, menu.ItemMoveCostThreshold)) { controllable.Pick(item); sleeper.Sleep(500, item.Handle); break; } } } }
public void DropItems(ItemStats dropItemStats, bool toBackpack = false, params IRecoveryAbility[] ignoredItems) { foreach (var item in GetItems(ItemStoredPlace.Inventory) .Where( x => ignoredItems.All(z => z.Handle != x.Handle) && !DroppedItems.Contains(x) && !disabledItems.Sleeping(x.Handle) && x.IsEnabled && x.IsDroppable && x.GetItemStats().HasFlag(dropItemStats))) { if (toBackpack && ItemsCanBeDisabled()) { if (!item.CanBeMovedToBackpack()) { continue; } var slot = GetItemSlot(item.Handle, ItemStoredPlace.Inventory); item.MoveItem(ItemSlot.BackPack_1); disabledItems.Sleep(6000, item.Handle); UsableAbilities.FirstOrDefault(x => x.Handle == item.Handle)?.SetSleep(6000); if (slot != null) { item.MoveItem(slot.Value); } } else { DropItem(item, ItemStoredPlace.Inventory); } } }
private void Modifier(Hero hero, Modifier modifier, Vector3 position, string modifierName, int sleepTime, HeroId heroId = 0) { try { var abilityTextureName = modifier.TextureName; if (modifierName.StartsWith("modifier_rune")) { abilityTextureName = modifierName.Substring("modifier_".Length); } var heroTextureName = hero.Name; if (MultiSleeper <string> .Sleeping($"Modifers_{abilityTextureName}_{heroTextureName}")) { return; } var player = hero.Player; if (player == null) { return; } Verification.ModifierVerification(position, heroTextureName, abilityTextureName, player.Id + 1, heroId); MultiSleeper <string> .Sleep($"Modifers_{abilityTextureName}_{heroTextureName}", sleepTime); } catch (Exception e) { Log.Error(e); } }
public static bool RazeCaster(Ability raze, Hero target, bool checkForAngle = true) { if (!raze.CanBeCasted()) { return(false); } if (Core.RazeCanceler.Sleeping(raze) || raze.IsInAbilityPhase) { if (raze.CanHit(target)) { return(true); } if (StopSleeper.Sleeping(raze)) { return(true); } Core.Me.Stop(); Core.RazeCanceler.Reset(raze); StopSleeper.Sleep(Game.Ping + 10, raze); Printer.Print($"stop: [sl: {Core.RazeCanceler.Sleeping(raze)}] [ph: {raze.IsInAbilityPhase}]"); } else if (raze.CanHit(target, true, checkForAngle)) { if (Core.Razes.Any(x => x.IsInAbilityPhase)) { return(false); } raze.UseAbility(); //StopSystem.New(raze, target); Core.RazeCanceler.Sleep(raze.GetAbilityDelay() + 50, raze); Printer.Print($"cast: [{raze.Name}]->{raze.GetAbilityDelay() + 50}"); return(true); } return(false); }
private void OnUpdate(EventArgs args) { if (!sleeper.Sleeping(units)) { foreach (var unit in ObjectManager.GetEntitiesParallel <Unit>() .Where(x => x.IsValid && !units.ContainsKey(x) && x.IsSpawned && x.IsAlive && !x.Equals(Hero))) { var obstacle = AddObstacle(unit.NetworkPosition, unit.HullRadius); if (obstacle != null) { units.Add(unit, obstacle.Value); } } sleeper.Sleep(1000, units); } if (!sleeper.Sleeping(Pathfinding)) { var remove = new List <Unit>(); foreach (var unitPair in units) { var unit = unitPair.Key; var obstacle = unitPair.Value; if (unit == null || !unit.IsValid || !unit.IsAlive) { remove.Add(unit); RemoveObstacle(obstacle); continue; } UpdateObstacle(obstacle, unit.NetworkPosition, unit.HullRadius); } foreach (var unit in remove) { units.Remove(unit); } sleeper.Sleep(100, Pathfinding); } }
public async Task UseAbilities(UnitBase unitBase) { if (unitBase.Hero.IsInvisible() || unitBase.Hero.Modifiers.Any(x => x.Name.Contains("windwalk"))) { return; } var flux = unitBase.Flux; var magneticField = unitBase.MagneticField; var spark = unitBase.Spark; if (!_multiSleeper.Sleeping(flux) && unitBase.AbilityChecker.IsAbilityEnabled(flux.GetAbilityId()) && flux.CanBeCasted() && flux.CanHit(Core.Target)) { flux.UseAbility(Core.Target); Printer.Both("Flux usages " + flux.GetAbilityDelay()); _multiSleeper.Sleep(500, flux); await Task.Delay(flux.GetAbilityDelay(), Core.ComboToken.Token); } var distance = unitBase.Hero.Distance2D(Core.Target); if (!_multiSleeper.Sleeping(magneticField) && magneticField != null && unitBase.AbilityChecker.IsAbilityEnabled(magneticField.GetAbilityId()) && magneticField.CanBeCasted() && !unitBase.Hero.HasModifier("modifier_arc_warden_magnetic_field") && distance <= 600 && Core.Target.IsVisible) { if (!MenuManager.MagneticField && Core.Target.IsMelee) { magneticField.UseAbility(Prediction.InFront(unitBase.Hero, -250)); } else { magneticField.UseAbility(Prediction.InFront(unitBase.Hero, 250)); } _multiSleeper.Sleep(500, magneticField); Printer.Both("MagneticField usages"); await Task.Delay(magneticField.GetAbilityDelay(), Core.ComboToken.Token); } if (!_multiSleeper.Sleeping(spark) && spark != null && unitBase.AbilityChecker.IsAbilityEnabled(spark.GetAbilityId()) && spark.CanBeCasted() && !Prediction.IsTurning(Core.Target) && unitBase.Hero.IsVisibleToEnemies) { var delay = spark.GetAbilityDelay(); var predVector3 = Prediction.PredictedXYZ(Core.Target, 2000 + delay); spark.UseAbility(predVector3); _multiSleeper.Sleep(500, spark); Printer.Both("spark usages"); await Task.Delay(spark.GetAbilityDelay(), Core.ComboToken.Token); } }
public bool Attack(Unit unit, Unit target) { if (!MultiSleeper.Sleeping($"Attack{ unit.Handle }")) { MultiSleeper.Sleep(200, $"Attack{ unit.Handle }"); return(unit.Attack(target)); } return(false); }
public bool BottleCanBeRefilled() { if (manager.MyHero.Distance2D(fountain) < 1300) { return(true); } if (!manager.MyHero.HasModifier(ModifierUtils.FountainRegeneration)) { return(false); } if (!sleeper.Sleeping("FountainRegeneration")) { sleeper.Sleep(5000, "FountainRegeneration"); sleeper.Sleep(2000, "CanRefill"); } return(sleeper.Sleeping("CanRefill")); }
private void GameOnIngameUpdate(EventArgs args) { if (!sleeper.Sleeping(deadCreeps) && deadCreeps.Any()) { foreach (var pair in deadCreeps) { var deadCreep = pair.Key; var enemiesInExpRange = enemies.Where(x => x.IsInExperienceRange(deadCreep)).ToList(); foreach (var enemy in enemiesInExpRange) { var totalExp = enemy.CalculateGainedExperience( deadCreeps.Where(x => enemy.IsInExperienceRange(x.Key)).Sum(x => x.Value)); if (enemy.OldExperience + totalExp / enemiesInExpRange.Count != enemy.NewExperience) { enemy.SetWarning(totalExp, enemiesInExpRange.Count, menu.WarningTime); } } } deadCreeps.Clear(); } if (sleeper.Sleeping(enemies)) { return; } foreach (var enemy in ObjectManager.GetEntitiesParallel <Hero>() .Where( x => x.IsValid && !enemies.Exists(z => z.Handle == x.Handle) && x.Team != heroTeam && !x.IsIllusion)) { enemies.Add(new Enemy(enemy)); } sleeper.Sleep(2000, enemies); }
/// <summary> /// The find angle r. /// </summary> /// <param name="entity"> /// The entity. /// </param> /// <returns> /// The <see cref="float" />. /// </returns> public static float FindAngleR(this Entity entity) { var handle = entity.Handle; var sleeping = sleeper.Sleeping(handle); var rotationRad = sleeping ? rotationDictionary[handle] : entity.RotationRad; if (!sleeping) { rotationDictionary[handle] = rotationRad; sleeper.Sleep(handle, 5); } return((float)(rotationRad < 0 ? Math.Abs(rotationRad) : 2 * Math.PI - rotationRad)); }
public bool Follow(Unit unit, Unit target) { if (unit.IsRooted()) { return(false); } if (!MultiSleeper.Sleeping($"Follow{ unit.Handle }")) { MultiSleeper.Sleep(200, $"Follow{ unit.Handle }"); return(unit.Follow(target)); } return(false); }
public bool Move(Unit unit, Vector3 position) { if (unit.IsRooted()) { return(false); } if (!MultiSleeper.Sleeping($"Move{ unit.Handle }")) { MultiSleeper.Sleep(200, $"Move{ unit.Handle }"); return(unit.Move(position)); } return(false); }
public virtual void UseAbilities(Hero target) { var spells = Me.Spellbook() .Spells.Where( x => !x.IsAbilityBehavior(AbilityBehavior.Passive) && x.AbilityType != AbilityType.Ultimate && x.CanBeCasted() && x.CanHit(target) && !_abilitySleeper.Sleeping(x)); foreach (var ability in spells) { if ((ability.AbilityBehavior & AbilityBehavior.Point) != 0) { if (ability.IsSkillShot()) { if (!ability.CastSkillShot(target)) { continue; } } else { ability.UseAbility(target.Position); } } else if ((ability.AbilityBehavior & AbilityBehavior.UnitTarget) != 0) { if (ability.TargetTeamType == TargetTeamType.Enemy) { ability.UseAbility(target); } else { continue; } } else { ability.UseAbility(); } var delay = Me.GetAbilityDelay(target, ability); Log.Debug($"Ability: {ability.StoredName()} -> {delay}ms"); _abilitySleeper.Sleep(delay, ability); } }
public static void OnUpdate(EventArgs args) { if (!MenuManager.IsEnable) { return; } var spellAmp = 0;//UnitExtensions.GetSpellAmplification(Me); foreach (var hero in Heroes.GetByTeam(EnemyTeam)) { if (HeroSleeper.Sleeping(hero) || !hero.IsAlive || !hero.IsVisible || !hero.CanDie(MenuManager.CheckForAegis)) { continue; } var listForDetonation = new List <BombManager>(); var heroHealth = hero.Health + hero.HealthRegeneration; var reduction = RemoteMine.GetDamageReduction(hero); foreach (var element in Bombs) { if (element.IsRemoteMine && element.Active) { if (element.CanHit(hero)) { //Printer.Print($"BombDelay: {element.GetBombDelay(hero)} MaxDelay: {MenuManager.GetBombDelay}"); if (MenuManager.IsEnableDelayBlow && !(element.GetBombDelay(hero) >= MenuManager.GetBombDelay)) { continue; } heroHealth -= DamageHelpers.GetSpellDamage(element.Damage, spellAmp, reduction); listForDetonation.Add(element); if (heroHealth <= 0) { HeroSleeper.Sleep(300 + listForDetonation.Count * 30, hero); foreach (var manager in listForDetonation) { manager.Detonate(); } break; } } } } } }
private bool InvokeThisShit(ActiveAbility ability) { InvokerCrappahilationPaid.Log.Debug($"Trying to invoke -> {ability.Ability.Id}"); if (_sleeper.Sleeping($"{ability} shit")) { InvokerCrappahilationPaid.Log.Debug($"Invoke [blocked] ({ability})"); return(false); } if (Abilities.Invoke.IsReady) { var requiredOrbs = (ability as IInvokableAbility)?.RequiredOrbs; if (requiredOrbs != null) { foreach (var abilityId in requiredOrbs) { var sphere = (ActiveAbility)_main.Context.AbilityFactory.GetAbility(abilityId); if (sphere == null) { return(false); } if (!sphere.UseAbility()) { return(false); } InvokerCrappahilationPaid.Log.Debug($"Invoke [Sphere: {abilityId}] ({ability})"); } var invoked = Abilities.Invoke.Ability.UseAbility(); if (invoked) { _sleeper.Sleep(200, $"{ability} shit"); InvokerCrappahilationPaid.Log.Debug($"Invoke [{ability}]"); } return(invoked); } InvokerCrappahilationPaid.Log.Debug($"Error in Invoke function: {ability.Ability.Id}"); return(false); } InvokerCrappahilationPaid.Log.Debug($"Invoke [on cd] ({ability})"); return(false); }
private bool UpdateDamage(Hero enemy, out bool heroWillDie) { if (_multiSleeper.Sleeping(enemy.Handle)) { if (_damageDict.TryGetValue(enemy.Handle, out var hp)) { heroWillDie = hp <= 0; if (!heroWillDie) { FlushTiming(enemy); } return(heroWillDie); } FlushTiming(enemy); heroWillDie = false; return(false); } _multiSleeper.Sleep(50, enemy.Handle); var willTakeDamageFromTornado = enemy.GetModifierByName(_config.Main.AbilitiesInCombo.Tornado.TargetModifierName) != null; var damageFromTornado = willTakeDamageFromTornado ? _config.Main.AbilitiesInCombo.Tornado.GetDamage(enemy) : 0; var healthAfterCast = enemy.Health + enemy.HealthRegeneration * 2 - SunStrike.GetDamage(enemy) - damageFromTornado; if (!_damageDict.TryGetValue(enemy.Handle, out _)) { _damageDict.Add(enemy.Handle, (int)healthAfterCast); } else { _damageDict[enemy.Handle] = (int)healthAfterCast; } heroWillDie = healthAfterCast <= 0; if (!heroWillDie) { FlushTiming(enemy); } return(heroWillDie); }
private void OnUpdate() { var heroes = EntityManager <Hero> .Entities.Where(x => x.IsValid && !x.IsIllusion).ToList(); DamageList.Clear(); foreach (var target in heroes.Where(x => x.IsAlive && x.IsEnemy(Owner)).ToList()) { List <BaseAbility> abilities = new List <BaseAbility>(); var hitArcaneBolt = 0.0f; if (target.IsVisible) { // AncientSeal var ancientSeal = Abilities.AncientSeal; if (ancientSeal.Ability.Level > 0 && Menu.AutoKillStealToggler.Value.IsEnabled(ancientSeal.ToString())) { abilities.Add(ancientSeal); } // Veil var veil = Abilities.Veil; if (veil != null && veil.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(veil.ToString())) { abilities.Add(veil); } // Ethereal var ethereal = Abilities.Ethereal; if (ethereal != null && ethereal.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(ethereal.ToString())) { abilities.Add(ethereal); } // Shivas var shivas = Abilities.Shivas; if (shivas != null && shivas.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled(shivas.ToString())) { abilities.Add(shivas); } // ConcussiveShot var concussiveShot = Abilities.ConcussiveShot; if (concussiveShot.Ability.Level > 0 && Menu.AutoKillStealToggler.Value.IsEnabled(concussiveShot.ToString()) && target == concussiveShot.TargetHit) { abilities.Add(concussiveShot); } // ArcaneBolt var arcaneBolt = Abilities.ArcaneBolt; if (arcaneBolt.Ability.Level > 0 && Menu.AutoKillStealToggler.Value.IsEnabled(arcaneBolt.ToString())) { abilities.Add(arcaneBolt); if (MultiSleeper.Sleeping($"arcanebolt_{ target.Name }")) { hitArcaneBolt += arcaneBolt.GetDamage(target); } } // Dagon var dagon = Abilities.Dagon; if (dagon != null && dagon.Ability.IsValid && Menu.AutoKillStealToggler.Value.IsEnabled("item_dagon_5")) { abilities.Add(dagon); } } var damageCalculation = new Combo(abilities.ToArray()); var damageReduction = -DamageReduction(target, heroes); var damageBlock = DamageBlock(target, heroes); var livingArmor = LivingArmor(target, heroes, damageCalculation.Abilities); var damage = DamageHelpers.GetSpellDamage((damageCalculation.GetDamage(target) + hitArcaneBolt) + damageBlock, 0, damageReduction) - livingArmor; var readyDamage = DamageHelpers.GetSpellDamage(damageCalculation.GetDamage(target, true, false) + damageBlock, 0, damageReduction) - livingArmor; var totalDamage = DamageHelpers.GetSpellDamage(damageCalculation.GetDamage(target, false, false) + damageBlock, 0, damageReduction) - livingArmor; if (target.IsInvulnerable() || target.HasAnyModifiers(BlockModifiers)) { damage = 0.0f; readyDamage = 0.0f; } DamageList.Add(new Damage(target, damage, readyDamage, totalDamage, target.Health)); } }
private async Task ExecuteAsync(CancellationToken token) { try { if (Game.IsPaused || !Owner.IsValid || !Owner.IsAlive || Owner.IsStunned() || Owner.IsInvisible()) { return; } if (Menu.AutoComboWhenComboItem && Menu.ComboKeyItem) { return; } if (Menu.AutoOwnerMinHealthItem > ((float)Owner.Health / Owner.MaximumHealth) * 100) { return; } var target = EntityManager <Hero> .Entities.Where(x => x.IsValid && x.IsVisible && x.IsAlive && !x.IsIllusion && x.IsEnemy(Owner) && Extensions.Active(x)).OrderBy(x => x.Distance2D(Owner)).FirstOrDefault(); if (target == null) { return; } if (!Extensions.Cancel(target) || Extensions.ComboBreaker(target, false)) { return; } if (Menu.BladeMailItem && target.HasModifier("modifier_item_blade_mail_reflect")) { return; } if (target.IsBlockingAbilities()) { Config.LinkenBreaker.Handler.RunAsync(); return; } var stunDebuff = target.Modifiers.FirstOrDefault(x => x.IsStunDebuff); var hexDebuff = target.Modifiers.FirstOrDefault(x => x.Name == "modifier_sheepstick_debuff"); // Hex var hex = Main.Hex; if (hex != null && Menu.AutoItemToggler.Value.IsEnabled(hex.ToString()) && hex.CanBeCasted && hex.CanHit(target) && (stunDebuff == null || !stunDebuff.IsValid || stunDebuff.RemainingTime <= 0.3f) && (hexDebuff == null || !hexDebuff.IsValid || hexDebuff.RemainingTime <= 0.3f)) { hex.UseAbility(target); await Await.Delay(hex.GetCastDelay(target), token); } // Orchid var orchid = Main.Orchid; if (orchid != null && Menu.AutoItemToggler.Value.IsEnabled(orchid.ToString()) && orchid.CanBeCasted && orchid.CanHit(target)) { orchid.UseAbility(target); await Await.Delay(orchid.GetCastDelay(target), token); } // Bloodthorn var bloodthorn = Main.Bloodthorn; if (bloodthorn != null && Menu.AutoItemToggler.Value.IsEnabled(bloodthorn.ToString()) && bloodthorn.CanBeCasted && bloodthorn.CanHit(target)) { bloodthorn.UseAbility(target); await Await.Delay(bloodthorn.GetCastDelay(target), token); } // Mystic Flare var mysticFlare = Main.MysticFlare; if (Menu.AutoAbilityToggler.Value.IsEnabled(mysticFlare.ToString()) && Menu.AutoMinHealthToUltItem <= ((float)target.Health / target.MaximumHealth) * 100 && mysticFlare.CanBeCasted && mysticFlare.CanHit(target)) { var enemies = EntityManager <Hero> .Entities.Where(x => x.IsVisible && x.IsAlive && x.IsValid && !x.IsIllusion && x.IsEnemy(Owner) && x.Distance2D(Owner) <= mysticFlare.CastRange).ToList(); var dubleMysticFlare = Owner.HasAghanimsScepter() && enemies.Count() == 1; var input = new PredictionInput { Owner = Owner, Range = mysticFlare.CastRange, Radius = dubleMysticFlare ? -250 : -100 }; var output = Prediction.GetPrediction(input.WithTarget(target)); mysticFlare.UseAbility(output.CastPosition); await Await.Delay(mysticFlare.GetCastDelay(output.CastPosition), token); } // Nullifier var nullifier = Main.Nullifier; if (nullifier != null && Menu.ItemToggler.Value.IsEnabled(nullifier.ToString()) && nullifier.CanBeCasted && nullifier.CanHit(target) && (stunDebuff == null || !stunDebuff.IsValid || stunDebuff.RemainingTime <= 0.5f) && (hexDebuff == null || !hexDebuff.IsValid || hexDebuff.RemainingTime <= 0.5f)) { nullifier.UseAbility(target); await Await.Delay(nullifier.GetCastDelay(target), token); } // RodofAtos var rodofAtos = Main.RodofAtos; if (rodofAtos != null && Menu.AutoItemToggler.Value.IsEnabled(rodofAtos.ToString()) && rodofAtos.CanBeCasted && rodofAtos.CanHit(target) && !target.Modifiers.Any(x => x.IsValid && x.Name == "modifier_rod_of_atos_debuff" && x.RemainingTime > 0.5f) && (stunDebuff == null || !stunDebuff.IsValid || stunDebuff.RemainingTime <= 0.5f)) { rodofAtos.UseAbility(target); await Await.Delay(rodofAtos.GetCastDelay(target), token); } // AncientSeal var ancientSeal = Main.AncientSeal; if (Menu.AutoAbilityToggler.Value.IsEnabled(ancientSeal.ToString()) && ancientSeal.CanBeCasted && ancientSeal.CanHit(target)) { ancientSeal.UseAbility(target); await Await.Delay(ancientSeal.GetCastDelay(target), token); return; } // Veil var veil = Main.Veil; if (veil != null && Menu.AutoItemToggler.Value.IsEnabled(veil.ToString()) && veil.CanBeCasted && veil.CanHit(target)) { veil.UseAbility(target.Position); await Await.Delay(veil.GetCastDelay(target.Position), token); } // Ethereal var ethereal = Main.Ethereal; if (ethereal != null && Menu.AutoItemToggler.Value.IsEnabled(ethereal.ToString()) && ethereal.CanBeCasted && ethereal.CanHit(target)) { ethereal.UseAbility(target); MultiSleeper.Sleep(ethereal.GetHitTime(target), "ethereal"); await Await.Delay(ethereal.GetCastDelay(target), token); } // Shivas var shivas = Main.Shivas; if (shivas != null && Menu.AutoItemToggler.Value.IsEnabled(shivas.ToString()) && shivas.CanBeCasted && shivas.CanHit(target)) { shivas.UseAbility(); await Await.Delay(shivas.GetCastDelay(), token); } if (!MultiSleeper.Sleeping("ethereal") || target.IsEthereal()) { // ConcussiveShot var concussiveShot = Main.ConcussiveShot; if (Menu.AutoAbilityToggler.Value.IsEnabled(concussiveShot.ToString()) && Extensions.ConcussiveShotTarget(target, concussiveShot.TargetHit) && concussiveShot.CanBeCasted && Owner.Distance2D(target) < Menu.ConcussiveShotUseRadiusItem - Owner.HullRadius) { concussiveShot.UseAbility(); await Await.Delay(concussiveShot.GetCastDelay(), token); } // ArcaneBolt var arcaneBolt = Main.ArcaneBolt; if (Menu.AutoAbilityToggler.Value.IsEnabled(arcaneBolt.ToString()) && arcaneBolt.CanBeCasted && arcaneBolt.CanHit(target)) { arcaneBolt.UseAbility(target); UpdateManager.BeginInvoke(() => { MultiSleeper.Sleep(arcaneBolt.GetHitTime(target) - (arcaneBolt.GetCastDelay(target) + 350), $"arcanebolt_{ target.Name }"); }, arcaneBolt.GetCastDelay(target) + 50); await Await.Delay(arcaneBolt.GetCastDelay(target), token); return; } // Dagon var dagon = Main.Dagon; if (dagon != null && Menu.AutoItemToggler.Value.IsEnabled("item_dagon_5") && dagon.CanBeCasted && dagon.CanHit(target)) { dagon.UseAbility(target); await Await.Delay(dagon.GetCastDelay(target), token); return; } } } catch (TaskCanceledException) { // canceled } catch (Exception e) { Main.Log.Error(e); } }
public static bool CanHit(this Ability ability, Unit target, Vector3 sourcePosition, string abilityName = null) { if (ability == null || !ability.IsValid) { return(false); } if (target == null || !target.IsValid) { return(false); } var name = abilityName ?? ability.StoredName(); if (ability.Owner.Equals(target)) { return(true); } var id = ability.Handle + target.Handle; if (sleeper.Sleeping(id)) { return(canHitDictionary[id]); } var position = sourcePosition; if (ability.IsAbilityBehavior(AbilityBehavior.Point, name) || name == "lion_impale") { var pred = ability.GetPrediction(target, abilityName: name); var lion = name == "lion_impale" ? ability.GetAbilityData("length_buffer") : 0; return(position.Distance2D(pred) <= ability.TravelDistance() + ability.GetRadius(name) + lion + target.HullRadius); } if (ability.IsAbilityBehavior(AbilityBehavior.NoTarget, name)) { var pred = ability.GetPrediction(target, abilityName: name); var distanceXyz = position.Distance2D(pred); var radius = ability.GetRadius(name); var range = ability.GetCastRange(name); if (name.StartsWith("nevermore_shadowraze")) { range += radius / 2; } if (name.Contains("earthshaker_enchant_totem") && (ability.Owner as Hero).AghanimState()) { range += 1100; } if (name.Contains("faceless_void_time_walk")) { range += GetAbilityCastRange(ability.Owner as Unit, ability); } if (distanceXyz <= range && position.Distance2D(target.Position) <= range) { canHitDictionary[id] = true; sleeper.Sleep(50, id); return(true); } canHitDictionary[id] = name == "pudge_rot" && target.HasModifier("modifier_pudge_meat_hook") && position.Distance2D(target) < 1500; sleeper.Sleep(50, id); return(canHitDictionary[id]); } if (!ability.IsAbilityBehavior(AbilityBehavior.UnitTarget, name)) { canHitDictionary[id] = false; sleeper.Sleep(50, id); return(false); } if (target.IsInvul()) { canHitDictionary[id] = false; sleeper.Sleep(50, id); return(false); } if (position.Distance2D(target.Position) <= GetAbilityCastRange(ability.Owner as Unit, ability) + 100) { canHitDictionary[id] = true; sleeper.Sleep(50, id); return(true); } canHitDictionary[id] = name == "pudge_dismember" && target.HasModifier("modifier_pudge_meat_hook") && position.Distance2D(target) < 600; sleeper.Sleep(50, id); return(canHitDictionary[id]); }
private void OnOnIngameUpdate(EventArgs args) { Mode = OrbwalkingMode.Idle; if (Game.IsPaused || Game.IsChatOpen) { return; } if (Members.Menu.Item("Combo.key").GetValue <KeyBind>().Active) { Mode = OrbwalkingMode.Combo; } else if (Mode == OrbwalkingMode.Idle) { _globalTarget = null; EffectManager.Remove("attackTarget" + Owner.Handle); return; } if (TurnEndTime > Game.RawGameTime) { return; } var target = GetTarget(); if (!UnitExtensions.HasModifier(Owner, "modifier_templar_assassin_meld")) { var tempTarget = GetTarget(false); if (tempTarget != null) { var blink = Owner.GetItemById(AbilityId.item_blink); var tempPos = new Vector3(); if (blink != null && blink.CanBeCasted() && blink.CanHit(tempTarget, ref tempPos) && !_sleeper.Sleeping(blink)) { blink.UseAbility(tempPos); _sleeper.Sleep(300, blink); } if (!UnitExtensions.HasModifier(tempTarget, "modifier_templar_assassin_trap_slow")) { var trap = UnitExtensions.GetAbilityById(ObjectManager.LocalHero, AbilityId.templar_assassin_psionic_trap); var trapNearTarget = EntityManager <Unit> .Entities.FirstOrDefault( x => x.IsValid && x.Name == "npc_dota_templar_assassin_psionic_trap" && Ensage.SDK.Extensions.EntityExtensions.Distance2D(tempTarget, x.Position) <= 400); if (trapNearTarget != null) { if (!_sleeper.Sleeping(trap + "activate")) { var activator = trapNearTarget.Spellbook.Spell1; if (activator.CanBeCasted()) { activator.UseAbility(); } _sleeper.Sleep(300, trap + "activate"); } } else if (trap.CanBeCasted()) { if (!_sleeper.Sleeping(trap + "place")) { trap.UseAbility(tempTarget.Position); _sleeper.Sleep(300, trap + "place"); } } } } } if ((target == null || !CanAttack(target)) && CanMove()) { if (Move(Game.MousePosition)) { return; } } if (target != null && CanAttack(target)) { LastTarget = target; var refraction = UnitExtensions.GetAbilityById(ObjectManager.LocalHero, AbilityId.templar_assassin_refraction); if (refraction.CanBeCasted() && !_sleeper.Sleeping(refraction)) { refraction.UseAbility(); _sleeper.Sleep(300, refraction); } var meld = UnitExtensions.GetAbilityById(ObjectManager.LocalHero, AbilityId.templar_assassin_meld); if (meld.CanBeCasted() && !_sleeper.Sleeping(meld)) { meld.UseAbility(); _sleeper.Sleep(300, meld); } Attack(target); } if (LastTarget != null && LastTarget.IsValid && LastTarget.IsAlive) { EffectManager.DrawRange(LastTarget, "attackTarget" + Owner.Handle, 60, Color.Red); } else { EffectManager.Remove("attackTarget" + Owner.Handle); } }