private void OnDrawingEndScene(EventArgs args) { try { if (Drawing.Direct3DDevice == null || Drawing.Direct3DDevice.IsDisposed) { return; } var totalSeconds = Menu.Item(Name + "DrawingTimeFormat").GetValue <StringList>().SelectedIndex == 1; foreach (var hero in _heroes.Where( hero => hero != null && hero.IsValid && hero.IsHPBarRendered && hero.Position.IsOnScreen())) { try { var lHero = hero; if (!hero.Position.IsValid() || !hero.HPBarPosition.IsValid()) { return; } var x = (int)hero.HPBarPosition.X - (hero.IsMe ? -10 : 8); var y = (int)hero.HPBarPosition.Y + (hero.IsEnemy ? 17 : (hero.IsMe ? 6 : 14)); _sprite.Begin(SpriteFlags.AlphaBlend); var summonerData = _summonerDatas[hero.NetworkId]; for (var i = 0; i < summonerData.Count; i++) { var spell = summonerData[i]; if (spell != null) { var teleportCd = 0f; if (spell.Name.Contains("Teleport", StringComparison.OrdinalIgnoreCase) && _teleports.ContainsKey(hero.NetworkId)) { _teleports.TryGetValue(hero.NetworkId, out teleportCd); } var t = teleportCd > 0.1f ? teleportCd - Game.Time : (spell.IsReady() ? 0 : spell.CooldownExpires - Game.Time); var sCd = teleportCd > 0.1f ? TeleportCd : spell.Cooldown; var percent = Math.Abs(sCd) > float.Epsilon ? t / sCd : 1f; var n = t > 0 ? (int)(19 * (1f - percent)) : 19; if (t > 0) { _text.DrawTextCentered( t.FormatTime(totalSeconds), x - (hero.IsMe ? -160 : 13), y + 7 + 13 * i, new ColorBGRA(255, 255, 255, 255)); } if (_summonerTextures.ContainsKey(Summoners.FixName(spell.Name))) { _sprite.Draw( _summonerTextures[Summoners.FixName(spell.Name)], new ColorBGRA(255, 255, 255, 255), new Rectangle(0, 12 * n, 12, 12), new Vector3(-x - (hero.IsMe ? 132 : 3), -y - 1 - 13 * i, 0)); } } } _sprite.Draw( hero.IsMe ? _hudSelfTexture : _hudTexture, new ColorBGRA(255, 255, 255, 255), null, new Vector3(-x, -y, 0)); _sprite.End(); var x2 = x + (hero.IsMe ? 24 : 19); var y2 = y + 21; _line.Begin(); var spellData = _spellDatas[hero.NetworkId]; foreach (var spell in spellData) { var lSpell = spell; if (spell != null) { var spell1 = spell; var manual = hero.IsAlly ? _manualAllySpells.FirstOrDefault( m => m.Slot.Equals(lSpell.Slot) && m.Champ.Equals(lHero.ChampionName, StringComparison.OrdinalIgnoreCase)) : _manualEnemySpells.FirstOrDefault( m => m.Slot.Equals(spell1.Slot) && m.Champ.Equals(lHero.ChampionName, StringComparison.OrdinalIgnoreCase)); var t = (manual != null ? manual.CooldownExpires : spell.CooldownExpires) - Game.Time; var spellCooldown = manual != null ? manual.Cooldown : spell.Cooldown; var percent = t > 0 && Math.Abs(spellCooldown) > float.Epsilon ? 1f - t / spellCooldown : 1f; if (t > 0 && t < 100) { _text.DrawTextCentered( t.FormatTime(totalSeconds), x2 + 27 / 2, y2 + 13, new ColorBGRA(255, 255, 255, 255)); } if (spell.Level > 0) { _line.Draw( new[] { new Vector2(x2, y2), new Vector2(x2 + percent * 23, y2) }, t > 0 ? new ColorBGRA(235, 137, 0, 255) : new ColorBGRA(0, 168, 25, 255)); } x2 = x2 + 27; } } _line.End(); } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } } } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } }