public void OnUpdate() { if (sleeper.Sleeping) { return; } sleeper.Sleep(50); if (!hero.IsAlive) { targetLocked = false; target = null; if (targetParticle != null) { targetParticle.Dispose(); targetParticle = null; } sleeper.Sleep(1000); return; } if (Game.IsPaused || !hero.CanCast() || hero.IsChanneling() || !menuManager.IsEnabled) { sleeper.Sleep(333); return; } if (!Utils.SleepCheck("Evader.Avoiding")) { return; } if (ghostShip.IsInPhase) { ghostShip.HitTime = Game.RawGameTime + ghostShip.CastRange / (hero.AghanimState() ? ghostShip.AghanimSpeed : ghostShip.Speed) + 0.12; } if (menuManager.TpHomeEanbled) { var teleport = hero.FindItem("item_travel_boots") ?? hero.FindItem("item_travel_boots_2") ?? hero.FindItem("item_tpscroll"); if (teleport != null && teleport.CanBeCasted() && xMark.CanBeCasted) { var manaRequired = teleport.ManaCost + xMark.ManaCost; if (hero.Mana < manaRequired) { return; } var fountain = ObjectManager.GetEntitiesParallel <Unit>() .FirstOrDefault( x => x.Team == heroTeam && x.ClassId == ClassId.CDOTA_Unit_Fountain && x.Distance2D(hero) > 2000); if (fountain == null) { return; } hero.Move(hero.Position.Extend(fountain.Position, 50)); xMark.UseAbility(hero); teleport.UseAbility(fountain, true); sleeper.Sleep(1000); return; } } if (menuManager.HitAndRunEnabled) { var blink = hero.FindItem("item_blink"); if (blink == null) { return; } var armlet = hero.FindItem("item_armlet"); var armletEnabled = hero.HasModifier("modifier_item_armlet_unholy_strength"); var hitTarget = (Unit) Creeps.All.OrderBy(x => x.Distance2D(Game.MousePosition)) .FirstOrDefault( x => x.Team != heroTeam && x.IsSpawned && x.IsVisible && x.Distance2D(hero) < 2000 && x.Distance2D(Game.MousePosition) < 250) ?? Heroes.All.OrderBy(x => x.Distance2D(Game.MousePosition)) .FirstOrDefault( x => x.Team != heroTeam && x.IsVisible && x.Distance2D(hero) < 2000 && x.Distance2D(Game.MousePosition) < 250); if (xReturn.CanBeCasted && !blink.CanBeCasted() && (hitTarget == null || !hitTarget.IsAlive || tideBringer.Casted)) { if (armlet != null && armletEnabled) { armlet.ToggleAbility(); } xReturn.UseAbility(); sleeper.Sleep(2000); return; } if (hitTarget == null || !hitTarget.IsAlive) { return; } if (armlet != null && !armletEnabled) { armlet.ToggleAbility(); } if (hitTarget.Distance2D(hero) > 1200) { hero.Move(hitTarget.Position); sleeper.Sleep(500); return; } if (xMark.CanBeCasted) { xMark.UseAbility(hero); sleeper.Sleep(xMark.GetSleepTime); return; } if (blink.CanBeCasted() && hero.HasModifier("modifier_kunkka_x_marks_the_spot")) { if (menuManager.HitAndRunDamageEnabled) { var sword = hero.FindItem("item_invis_sword") ?? hero.FindItem("item_silver_edge"); if (sword != null && sword.CanBeCasted()) { sword.UseAbility(); } } blink.UseAbility(hitTarget.Position.Extend(hero.Position, hero.AttackRange)); tideBringer.UseAbility(hitTarget, true); sleeper.Sleep(300); return; } } if (menuManager.TorrentOnStaticObjectsEnabled) { if (!torrent.CanBeCasted) { return; } var reincarnating = ObjectManager.GetEntitiesParallel <Hero>() .FirstOrDefault( x => x.IsValid && !x.IsIllusion && x.IsReincarnating && x.Distance2D(hero) < torrent.CastRange); if (reincarnating != null) { if (reincarnating.RespawnTime - Game.RawGameTime < torrent.AdditionalDelay + Game.Ping / 1000 + 0.42) { torrent.UseAbility(reincarnating.Position); sleeper.Sleep(300); } return; } var gameTime = Game.GameTime; if (gameTime % 120 < (gameTime > 0 ? 119.5 : -0.5) - torrent.AdditionalDelay - Game.Ping / 1000) { return; } var rune = runePositions.OrderBy(x => x.Distance2D(hero)).First(); if (rune.Distance2D(hero) > torrent.CastRange) { return; } torrent.UseAbility(rune); sleeper.Sleep(torrent.GetSleepTime); return; } if (!targetLocked && !xMark.IsInPhase) { var mouse = Game.MousePosition; target = ObjectManager.GetEntitiesParallel <Hero>() .Where( x => x.IsValid && x.IsAlive && x.IsVisible && !x.IsIllusion && x.Team != heroTeam && x.Distance2D(mouse) < 600) .OrderBy(x => x.Distance2D(mouse)) .FirstOrDefault(); } if (target == null || xMark.CastRange < hero.Distance2D(target) && !targetLocked) { if (targetParticle != null) { targetParticle.Dispose(); targetParticle = null; } target = null; } else if (target != null) { if (targetParticle == null) { targetParticle = new ParticleEffect(@"materials\ensage_ui\particles\target.vpcf", target); } if (target.IsLinkensProtected() || target.IsMagicImmune()) { targetParticle?.SetControlPoint(5, new Vector3(0, 125, 0)); } else { targetParticle.SetControlPoint(5, new Vector3(255, 0, 0)); } } if (menuManager.ComboEnabled && target != null) { var fullCombo = menuManager.FullComboEnabled; if (!comboStarted) { if (!CheckCombo(fullCombo, targetLocked)) { targetParticle?.SetControlPoint(5, new Vector3(30, 144, 255)); return; } var manaRequired = allSpells.Where(x => (x != ghostShip || fullCombo) && x.CanBeCasted) .Aggregate(0u, (current, spell) => current + spell.ManaCost); if (manaRequired > hero.Mana) { targetParticle?.SetControlPoint(5, new Vector3(30, 144, 255)); return; } targetLocked = true; comboStarted = true; } if (!target.IsValid || target.IsMagicImmune() || target.IsLinkensProtected()) { targetLocked = false; return; } if (xMark.CanBeCasted) { xMark.UseAbility(target); sleeper.Sleep(570); return; } if (xMark.Position.IsZero) { return; } if (ghostShip.CanBeCasted && fullCombo) { if (hero.Distance2D(xMark.Position) < ghostShip.CastRange - ghostShip.Radius) { hero.Move(xMark.Position.Extend(hero.Position, ghostShip.CastRange)); sleeper.Sleep(100); return; } if (!hero.AghanimState() && torrent.CanBeCasted) { ghostShip.UseAbility(xMark.Position.Extend(hero.Position, ghostShip.Radius / 2)); sleeper.Sleep(ghostShip.GetSleepTime); return; } if (torrent.Casted && Game.RawGameTime >= torrent.HitTime - ghostShip.CastPoint - xReturn.CastPoint - Game.Ping / 1000) { ghostShip.UseAbility(GetTorrentThinker()?.Position ?? xMark.Position); } } if (torrent.CanBeCasted && (!fullCombo || (ghostShip.CanBeCasted || !hero.AghanimState() && ghostShip.Cooldown > 2))) { torrent.UseAbility(xMark.Position); sleeper.Sleep(torrent.GetSleepTime); return; } if (xReturn.CanBeCasted && torrent.Casted && Game.RawGameTime >= torrent.HitTime - xReturn.CastPoint - Game.Ping / 1000) { xReturn.UseAbility(); sleeper.Sleep(xReturn.GetSleepTime); return; } } else if (comboStarted && !xMark.IsInPhase && xReturn.Casted) { comboStarted = false; targetLocked = false; } if (xMark.Casted && xReturn.CanBeCasted && menuManager.AutoReturnEnabled && !comboStarted) { var gameTime = Game.RawGameTime; var pudge = Heroes.GetByTeam(heroTeam) .FirstOrDefault(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Pudge && x.IsAlive && !x.IsIllusion); if (pudge != null) { var hook = pudge.Spellbook.SpellQ; if (hook.IsInAbilityPhase) { if (hookCasted) { return; } hookHitTime = CalculateHitTime(pudge, hook, gameTime, 0); if (hookHitTime > 0) { hookCasted = true; } } else if (hookCasted && hook.AbilityState != AbilityState.OnCooldown) { hookCasted = false; } } var mirana = Heroes.GetByTeam(heroTeam) .FirstOrDefault(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Mirana && x.IsAlive && !x.IsIllusion); if (mirana != null) { var arrow = mirana.Spellbook.SpellW; if (arrow.IsInAbilityPhase) { if (arrowCasted) { return; } arrowHitTime = CalculateHitTime(mirana, arrow, gameTime); if (arrowHitTime > 0) { arrowCasted = true; } } else if (arrowCasted && arrow.AbilityState != AbilityState.OnCooldown) { arrowCasted = false; } } var delay = xReturn.CastPoint + Game.Ping / 1000; if (torrent.Casted) { var torrentThinker = GetTorrentThinker(); if (torrentThinker != null) { if (xMark.Position.Distance2D(torrentThinker) > torrent.Radius) { return; } var modifier = torrentThinker.FindModifier("modifier_kunkka_torrent_thinker"); var hitTime = torrent.AdditionalDelay - modifier.ElapsedTime - 0.15; if (hitTime <= delay) { xReturn.UseAbility(); targetLocked = false; } } } if (ghostShip.JustCasted) { var hitTime = ghostShip.HitTime; if (!hero.AghanimState()) { hitTime += 0.25 - 0.25 / (150 / Math.Min(Game.Ping, 150)); } else { hitTime -= 0.25 / (150 / Math.Min(Game.Ping, 150)); } if (xMark.Position.Distance2D(ghostShip.Position) <= ghostShip.Radius && hitTime <= gameTime - delay) { xReturn.UseAbility(); } } if (arrowCasted && gameTime >= arrowHitTime - delay) { xReturn.UseAbility(); targetLocked = false; arrowCasted = false; } if (hookCasted && gameTime >= hookHitTime - delay) { xReturn.UseAbility(); targetLocked = false; hookCasted = false; } } }
public void OnUpdate() { if (!Utils.SleepCheck("Kunkka.Sleep")) { return; } if (Game.IsPaused || !hero.IsAlive || !hero.CanCast() || hero.IsChanneling() || !menuManager.IsEnabled) { Utils.Sleep(333, "Kunkka.Sleep"); return; } if (!xMark.PositionUpdated && targetLocked) { if (xMark.TimeCasted + xMark.CastPoint >= Game.RawGameTime && target != null && target.IsVisible) { xMark.Position = target.NetworkPosition; return; } xMark.PhaseStarted = false; xMark.PositionUpdated = true; } if (manualTarget != null && xMark.IsInPhase && !xMark.PhaseStarted) { xMark.PhaseStarted = true; target = manualTarget; targetLocked = true; xMark.Position = target.NetworkPosition; xMark.TimeCasted = Game.RawGameTime + Game.Ping / 1000; manualTarget = null; return; } if (menuManager.TpHomeEanbled) { var teleport = hero.FindItem("item_travel_boots") ?? hero.FindItem("item_travel_boots_2") ?? hero.FindItem("item_tpscroll"); if (teleport != null && teleport.CanBeCasted() && xMark.CanBeCasted) { var fountain = ObjectManager.GetEntities <Unit>() .FirstOrDefault( x => x.Team == heroTeam && x.ClassID == ClassID.CDOTA_Unit_Fountain && x.Distance2D(hero) > 2000); if (fountain == null) { return; } xMark.UseAbility(hero); teleport.UseAbility(fountain, true); Utils.Sleep(1000, "Kunkka.Sleep"); return; } } if (menuManager.HitAndRunEnabled) { var blink = hero.FindItem("item_blink"); if (blink == null) { return; } var hitTarget = (Unit) Creeps.All.OrderBy(x => x.Distance2D(Game.MousePosition)) .FirstOrDefault( x => x.Team != heroTeam && x.IsSpawned && x.IsVisible && x.Distance2D(hero) < 2000 && x.Distance2D(Game.MousePosition) < 250) ?? Heroes.All.OrderBy(x => x.Distance2D(Game.MousePosition)) .FirstOrDefault( x => x.Team != heroTeam && x.IsVisible && x.Distance2D(hero) < 2000 && x.Distance2D(Game.MousePosition) < 250); if (xReturn.CanBeCasted && !blink.CanBeCasted() && (hitTarget == null || !hitTarget.IsAlive || tideBringer.Casted)) { xReturn.UseAbility(); Utils.Sleep(500, "Kunkka.Sleep"); return; } if (hitTarget == null || !hitTarget.IsAlive) { return; } if (hitTarget.Distance2D(hero) > 1200) { hero.Move(hitTarget.Position); Utils.Sleep(500, "Kunkka.Sleep"); return; } if (xMark.CanBeCasted) { xMark.UseAbility(hero); Utils.Sleep(xMark.GetSleepTime, "Kunkka.Sleep"); return; } if (blink.CanBeCasted() && hero.HasModifier("modifier_kunkka_x_marks_the_spot")) { blink.UseAbility(hitTarget.Position.Extend(hero.Position, hero.AttackRange)); tideBringer.UseAbility(hitTarget, true); Utils.Sleep(300, "Kunkka.Sleep"); return; } } if (menuManager.TorrentOnRuneEnabled) { var gameTime = Game.GameTime; if (gameTime % 120 < (gameTime > 0 ? 119.5 : -0.5) - torrent.AdditionalDelay - Game.Ping / 1000 || !torrent.CanBeCasted) { return; } var rune = runePositions.OrderBy(x => x.Distance2D(hero)).First(); if (rune.Distance2D(hero) > torrent.CastRange) { return; } torrent.UseAbility(rune); Utils.Sleep(torrent.GetSleepTime, "Kunkka.Sleep"); return; } if (menuManager.ComboEnabled) { var fullCombo = menuManager.FullComboEnabled; if (!comboStarted) { if (target == null) { return; } if (!CheckCombo(fullCombo, targetLocked)) { return; } var manaRequired = allSpells.Where(x => (x != ghostShip || fullCombo) && x.CanBeCasted) .Aggregate(0u, (current, spell) => current + spell.ManaCost); if (manaRequired > hero.Mana) { return; } if (!targetLocked) { xMark.Position = target.NetworkPosition; } targetLocked = true; comboStarted = true; } if (target == null || !target.IsValid || target.IsMagicImmune()) { return; } if (xMark.CanBeCasted) { xMark.UseAbility(target); return; } if (ghostShip.CanBeCasted && fullCombo) { if (!hero.AghanimState() && torrent.CanBeCasted) { ghostShip.UseAbility(xMark.Position); Utils.Sleep(ghostShip.GetSleepTime, "Kunkka.Sleep"); return; } if (torrent.Casted && Game.RawGameTime >= torrent.HitTime - ghostShip.CastPoint - xReturn.CastPoint - Game.Ping / 1000) { ghostShip.UseAbility(GetTorrentThinker()?.Position ?? xMark.Position); } } if (torrent.CanBeCasted && (!fullCombo || (ghostShip.CanBeCasted || !hero.AghanimState() && ghostShip.Cooldown > 2))) { torrent.UseAbility(xMark.Position); Utils.Sleep(torrent.GetSleepTime, "Kunkka.Sleep"); return; } if (xReturn.CanBeCasted && torrent.Casted && Game.RawGameTime >= torrent.HitTime - xReturn.CastPoint - Game.Ping / 1000) { xReturn.UseAbility(); Utils.Sleep(xReturn.GetSleepTime, "Kunkka.Sleep"); return; } } else if (comboStarted && !xMark.IsInPhase && xReturn.Casted) { comboStarted = false; targetLocked = false; } if (xMark.Casted && xReturn.CanBeCasted && menuManager.AutoReturnEnabled && !comboStarted) { var gameTime = Game.RawGameTime; var pudge = Heroes.GetByTeam(heroTeam) .FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Pudge && x.IsAlive && !x.IsIllusion); if (pudge != null) { var hook = pudge.Spellbook.SpellQ; if (hook.IsInAbilityPhase) { if (hookCasted) { return; } hookHitTime = CalculateHitTime(pudge, hook, gameTime, 0); if (hookHitTime > 0) { hookCasted = true; } } else if (hookCasted && hook.AbilityState != AbilityState.OnCooldown) { hookCasted = false; } } var mirana = Heroes.GetByTeam(heroTeam) .FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Mirana && x.IsAlive && !x.IsIllusion); if (mirana != null) { var arrow = mirana.Spellbook.SpellW; if (arrow.IsInAbilityPhase) { if (arrowCasted) { return; } arrowHitTime = CalculateHitTime(mirana, arrow, gameTime); if (arrowHitTime > 0) { arrowCasted = true; } } else if (arrowCasted && arrow.AbilityState != AbilityState.OnCooldown) { arrowCasted = false; } } var delay = xReturn.CastPoint + Game.Ping / 1000; if (torrent.Casted) { var torrentThinker = GetTorrentThinker(); if (torrentThinker != null) { if (xMark.Position.Distance2D(torrentThinker) > torrent.Radius) { return; } var modifier = torrentThinker.FindModifier("modifier_kunkka_torrent_thinker"); var hitTime = torrent.AdditionalDelay - modifier.ElapsedTime - 0.15; if (hitTime <= delay) { xReturn.UseAbility(); targetLocked = false; } } } if (arrowCasted && gameTime >= arrowHitTime - delay) { xReturn.UseAbility(); targetLocked = false; arrowCasted = false; } if (hookCasted && gameTime >= hookHitTime - delay) { xReturn.UseAbility(); targetLocked = false; hookCasted = false; } } if (targetLocked && xMark.Casted && xReturn.Casted) { targetLocked = false; } Utils.Sleep(50, "Kunkka.Sleep"); }