private void OnDraw(EventArgs args) { if (!DrawGlobal.CurrentValue) { // Complete drawing turned off return; } foreach (var enemy in EntityManager.Heroes.Enemies.Where(o => !o.IsDead || o.IsInRange(EnemySpawnPoint, 250))) { // Get the minimap position var pos = enemy.ServerPosition.WorldToMinimap(); if (LastSeen.ContainsKey(enemy.NetworkId)) { // Update the position pos = LastSeenPosition[enemy.NetworkId].WorldToMinimap(); // Get the time being invisible in seconds var invisibleTime = (Core.GameTickCount - LastSeen[enemy.NetworkId]) / 1000f; // Predicted movement circle if (DrawMovementCircle.CurrentValue) { // Get the radius the champ could have walked var radius = LastSeenRange.ContainsKey(enemy.NetworkId) ? LastSeenRange[enemy.NetworkId] : (enemy.MoveSpeed > 1 ? enemy.MoveSpeed : 540) * invisibleTime; // Don't roast toasters if (radius < RangeCircleDisableRange.CurrentValue * 10) { Utilities.DrawCricleMinimap(pos, radius * Utilities.MinimapMultiplicator, Color.Red, 1, 500); } } // Draw the minimap icon ChampionSprites[enemy.Hero].Draw(pos + MinimapIconOffset); // Draw the time being invisible if (DrawInvisibleTime.CurrentValue && invisibleTime >= DelayInvisibleTime.CurrentValue) { var text = Math.Floor(invisibleTime).ToString(CultureInfo.InvariantCulture); var bounding = TimerText.MeasureBounding(text); TimerText.Draw(text, TimerText.Color, pos - (new Vector2(bounding.Width, bounding.Height) / 2) + 1); } } // Draw recall circle if (DrawRecallCircle.CurrentValue && RecallingHeroes.ContainsKey(enemy.NetworkId)) { var startTime = RecallingHeroes[enemy.NetworkId].Item1; var duration = RecallingHeroes[enemy.NetworkId].Item2; Utilities.DrawArc(pos, (MinimapIconSize + 4) / 2f, Color.Aqua, 3.1415f, Utilities.PI2 * ((Core.GameTickCount - startTime) / (float)duration), 2f, 100); } } }
private void OnTick(EventArgs args) { // Time elapsed since last update var elapsed = Core.GameTickCount - LastUpdate; LastUpdate = Core.GameTickCount; foreach (var enemy in EntityManager.Heroes.Enemies) { // Check if hero is dead if (enemy.IsDead && !DeadHeroes.Contains(enemy.NetworkId)) { DeadHeroes.Add(enemy.NetworkId); } // Check if hero was dead but respawned if (!enemy.IsDead && DeadHeroes.Contains(enemy.NetworkId)) { DeadHeroes.Remove(enemy.NetworkId); LastSeen[enemy.NetworkId] = Core.GameTickCount; LastSeenPosition[enemy.NetworkId] = EnemySpawnPoint; LastSeenRange[enemy.NetworkId] = 0; } // Update last seen range if (elapsed > 0 && LastSeenRange.ContainsKey(enemy.NetworkId) && !RecallingHeroes.ContainsKey(enemy.NetworkId)) { LastSeenRange[enemy.NetworkId] = LastSeenRange[enemy.NetworkId] + (enemy.MoveSpeed > 1 ? enemy.MoveSpeed : 540) * elapsed / 1000f; } if (enemy.IsInRange(EnemySpawnPoint, 250)) { LastSeenPosition[enemy.NetworkId] = EnemySpawnPoint; } if (enemy.IsHPBarRendered) { // Remove from last seen LastSeen.Remove(enemy.NetworkId); LastSeenPosition.Remove(enemy.NetworkId); } else { if (!LastSeen.ContainsKey(enemy.NetworkId)) { // Add to last seen LastSeen.Add(enemy.NetworkId, Core.GameTickCount); LastSeenPosition[enemy.NetworkId] = enemy.ServerPosition; LastSeenRange[enemy.NetworkId] = 0; } } } }