Esempio n. 1
0
        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));
            }
        }
Esempio n. 2
0
        private void Drawing_OnEndScene(EventArgs args)
        {
            if (!IsRecallTrackerEnabled || !ActiveTeleports.Any() || Drawing.Direct3DDevice.IsDisposed)
            {
                return;
            }

            if (ActiveTeleports.Any())
            {
                Drawing.DrawLine(BarPosition, new Vector2(BarPosition.X + BarWidth, BarPosition.Y), RecallTrackerBarSize,
                                 Color.FromArgb(ColorPicker.Color.A, ColorPicker.Color.R, ColorPicker.Color.G, ColorPicker.Color.B));
            }

            foreach (
                var teleport in
                ActiveTeleports.Where(x => x.Value != null && x.Value.Status == TeleportStatus.Start).OrderByDescending(x => x.Value.Start))
            {
                var caster = EntityManager.Heroes.AllHeroes.Find(x => x.NetworkId == teleport.Key);
                if (caster == null)
                {
                    continue;
                }

                var count = GetIndex(ActiveTeleports, teleport.Key) + 1;

                var endTime    = teleport.Value.Start + teleport.Value.Duration;
                var percentage = Math.Max(0, Math.Min(100, ((float)endTime - Core.GameTickCount) / teleport.Value.Duration * 100));
                var degree     = Misc.GetNumberInRangeFromProcent(percentage, 3, 110);
                var color      =
                    new Misc.HsvColor(degree, 1, 1)
                {
                    Value =
                        Misc.GetNumberInRangeFromProcent(
                            Math.Max(0, Math.Min((GetIndex(ActiveTeleports, teleport.Key) + 1f) / ActiveTeleports.Count * 100, 100)),
                            0.35f, 1)
                }.ColorFromHsv();

                var endPos = new Vector2(BarPosition.X + BarWidth * percentage / 100, BarPosition.Y);

                var stringBuilder = new StringBuilder();

                stringBuilder.Append($"{caster.Hero} ({(int)caster.Health} HP) ");
                stringBuilder.Append($"{((endTime - Core.GameTickCount)/1000F).ToString("F1")}s ");
                stringBuilder.Append($"({percentage.ToString("F1")}%)");

                Vector2[] linePos =
                {
                    new Vector2(endPos.X, BarPosition.Y + RecallTrackerBarSize / 2f - (int)(TextHeight * 1.27f * count)),
                    new Vector2(endPos.X, BarPosition.Y + RecallTrackerBarSize / 2f)
                };

                Text.Draw(stringBuilder.ToString(), Color.AliceBlue, new Vector2(endPos.X + 5, endPos.Y - TextHeight * 1.25f * count));

                Drawing.DrawLine(BarPosition, endPos, RecallTrackerBarSize, color);

                Drawing.DrawLine(linePos[0], linePos[1], 1, Color.AliceBlue);
            }
        }
Esempio n. 3
0
        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);
                }
            }
        }