private void Teleport_OnTeleport(Obj_AI_Base sender, Teleport.TeleportEventArgs args) { if (sender?.Type != GameObjectType.AIHeroClient) { return; } var hero = sender as AIHeroClient; if (hero == null || hero.IsMe || !hero.IsEnemy || args.Type == TeleportType.Shen) { return; } switch (args.Status) { case TeleportStatus.Start: if (args.Type == TeleportType.Recall) { if (IsRecallTrackerEnabled) { Notifications.Show(new SimpleNotification("Recall tracker", $"{hero.Hero} ({hero.Name}) just started recalling."), 2500); } ActiveRecalls[hero.NetworkId] = args; } ActiveTeleports[hero.NetworkId] = args; break; case TeleportStatus.Abort: if (args.Type == TeleportType.Recall) { ActiveRecalls.Remove(hero.NetworkId); } ActiveTeleports.Remove(hero.NetworkId); break; case TeleportStatus.Finish: if (args.Type == TeleportType.Recall) { if (IsRecallTrackerEnabled) { Notifications.Show(new SimpleNotification("Recall tracker", $"{hero.Hero} ({hero.Name}) just finished recalling."), 2500); } ActiveRecalls.Remove(hero.NetworkId); } ActiveTeleports.Remove(hero.NetworkId); break; case TeleportStatus.Unknown: ActiveTeleports.Remove(hero.NetworkId); ActiveRecalls.Remove(hero.NetworkId); return; default: throw new ArgumentOutOfRangeException(nameof(args.Status)); } }
private void Game_OnTick(EventArgs args) { ActiveTeleports.Select(x => x.Key).ToList().ForEach(x => { if (ActiveTeleports.ContainsKey(x) && ((Core.GameTickCount - ActiveTeleports[x].Start > ActiveTeleports[x].Duration) || ActiveTeleports[x].Status != TeleportStatus.Start)) { ActiveTeleports.Remove(x); } }); ActiveRecalls.Select(x => x.Key).ToList().ForEach(x => { if (ActiveRecalls.ContainsKey(x) && ((Core.GameTickCount - ActiveRecalls[x].Start > ActiveRecalls[x].Duration) || ActiveRecalls[x].Status != TeleportStatus.Start)) { ActiveRecalls.Remove(x); } }); if (!IsEnabled || !IsBaseUltEnabled || !Player.Instance.Spellbook.GetSpell(SpellSlot.R).IsReady) { return; } if (DisableBaseUltInComboMode && Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo)) { return; } foreach (var recall in ActiveRecalls) { var caster = EntityManager.Heroes.AllHeroes.Find(x => x.NetworkId == recall.Key); if (caster == null || !caster.IsEnemy || recall.Value == null || !IsEnabledFor(caster.ChampionName) || Collides(caster, SpawnPoint.Position)) { continue; } var invisibleFor = (Core.GameTickCount - caster.GetVisibilityTrackerData().LastVisibleGameTime * 1000) / 1000; // in seconds if (invisibleFor > MaxInvisibilityTime) { continue; } var damage = GetUltDamage(caster); var travelTime = GetUltTravelTime(SpawnPoint.Position); var timeLeft = recall.Value.Start + recall.Value.Duration - Core.GameTickCount; if ((damage >= Damage.GetHealthAfterTime(caster, timeLeft / 1000)) && (timeLeft - travelTime >= -130) && (timeLeft - travelTime <= -75)) { Player.Instance.Spellbook.CastSpell(SpellSlot.R, SpawnPoint.Position); } } }