private string ReadableSummonerName(string name) { name = Summoners.FixName(name); switch (name) { case "summonerflash": return("Flash"); case "summonerdot": return("Ignite"); case "summonerheal": return("Heal"); case "summonerteleport": return("Teleport"); case "summonerexhaust": return("Exhaust"); case "summonerhaste": return("Ghost"); case "summonerbarrier": return("Barrier"); case "summonerboost": return("Cleanse"); case "summonersmite": return("Smite"); } return(null); }
protected override void OnInitialize() { try { if (!GameObjects.EnemyHeroes.Any()) { OnUnload(null, new UnloadEventArgs(true)); return; } _hudTexture = Resources.SB_Hud.Scale(_scale).ToTexture(); _invisibleTexture = Resources.SB_Invisible.Scale(_scale).ToTexture(); _teleportAbortTexture = Resources.SB_RecallAbort.Scale(_scale).ToTexture(); _teleportFinishTexture = Resources.SB_RecallFinish.Scale(_scale).ToTexture(); _teleportStartTexture = Resources.SB_RecallStart.Scale(_scale).ToTexture(); _ultimateTexture = Resources.SB_Ultimate.Scale(_scale).ToTexture(); foreach (var enemy in GameObjects.EnemyHeroes) { var lEnemy = enemy; _spellDatas.Add(enemy.NetworkId, _summonerSpellSlots.Select(slot => lEnemy.GetSpell(slot)).ToList()); } foreach (var enemy in GameObjects.EnemyHeroes) { _enemyObjects.Add( new EnemyObject( enemy, (ImageLoader.Load("SB", enemy.ChampionName) ?? Resources.SB_Default).Scale(_scale) .ToTexture())); } foreach (var summonerSlot in _summonerSpellSlots) { foreach (var enemy in GameObjects.EnemyHeroes) { var spell = enemy.Spellbook.GetSpell(summonerSlot); if (!_summonerTextures.ContainsKey(Summoners.FixName(spell.Name))) { _summonerTextures[Summoners.FixName(spell.Name)] = ((Bitmap) Resources.ResourceManager.GetObject( string.Format("SB_{0}", Summoners.FixName(spell.Name))) ?? Resources.SB_summonerbarrier).Scale(_scale).ToTexture(); } } } base.OnInitialize(); } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } }
protected override void OnInitialize() { try { _hudTexture = Resources.CD_Hud.ToTexture(); _hudSelfTexture = Resources.CD_HudSelf.ToTexture(); foreach (var enemy in GameObjects.Heroes) { var lEnemy = enemy; _spellDatas.Add(enemy.NetworkId, _spellSlots.Select(slot => lEnemy.GetSpell(slot)).ToList()); _summonerDatas.Add(enemy.NetworkId, _summonerSlots.Select(slot => lEnemy.GetSpell(slot)).ToList()); } foreach (var sName in GameObjects.Heroes.SelectMany( h => _summonerSlots.Select(summoner => h.Spellbook.GetSpell(summoner).Name.ToLower()) .Where(sName => !_summonerTextures.ContainsKey(Summoners.FixName(sName))))) { _summonerTextures[Summoners.FixName(sName)] = ((Bitmap)Resources.ResourceManager.GetObject(string.Format("CD_{0}", Summoners.FixName(sName))) ?? Resources.CD_SummonerBarrier).ToTexture(); } _heroes = Menu.Item(Name + "DrawingAlly").GetValue <bool>() && Menu.Item(Name + "DrawingEnemy").GetValue <bool>() ? GameObjects.Heroes.ToList() : (Menu.Item(Name + "DrawingAlly").GetValue <bool>() ? GameObjects.AllyHeroes : (Menu.Item(Name + "DrawingEnemy").GetValue <bool>() ? GameObjects.EnemyHeroes : new List <AIHeroClient>())).ToList(); if (!Menu.Item(Name + "DrawingSelf").GetValue <bool>()) { _heroes.RemoveAll(h => h.NetworkId == ObjectManager.Player.NetworkId); } base.OnInitialize(); } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } }
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)); } }
private void OnDrawingEndScene(EventArgs args) { try { if (Drawing.Direct3DDevice == null || Drawing.Direct3DDevice.IsDisposed) { return; } var index = 0; var hudWidth = (float)Math.Ceiling(HudWidth * _scale); var hudHeight = (float)Math.Ceiling(HudHeight * _scale); var spacing = (float) Math.Ceiling((10f + Menu.Item(Menu.Name + "DrawingSpacing").GetValue <Slider>().Value) * _scale) + hudHeight; var offsetTop = Menu.Item(Menu.Name + "DrawingOffsetTop").GetValue <Slider>().Value + hudHeight / 2f; var offsetRight = Drawing.Width - Menu.Item(Menu.Name + "DrawingOffsetRight").GetValue <Slider>().Value - (hudWidth + (float)Math.Ceiling(4 * _scale)) / 2f; foreach (var enemy in _enemyObjects) { if (enemy.Unit.IsDead && Game.Time > enemy.DeathEndTime) { enemy.DeathEndTime = Game.Time + enemy.Unit.DeathDuration + 1; } else if (!enemy.Unit.IsDead) { enemy.DeathEndTime = 0; } var offset = spacing * index; var spellData = _spellDatas[enemy.Unit.NetworkId]; for (var i = 0; spellData.Count > i; i++) { var spell = spellData[i]; if (spell != null && _summonerTextures.ContainsKey(Summoners.FixName(spell.Name))) { var teleportCd = 0f; if (spell.Name.Contains("Teleport", StringComparison.OrdinalIgnoreCase) && _teleports.ContainsKey(enemy.Unit.NetworkId)) { _teleports.TryGetValue(enemy.Unit.NetworkId, out teleportCd); } var time = (teleportCd > 0.1f ? teleportCd : spell.CooldownExpires) - Game.Time; _sprite.Begin(SpriteFlags.AlphaBlend); _sprite.DrawCentered( _summonerTextures[Summoners.FixName(spell.Name)], new Vector2( offsetRight + hudWidth * 0.355f, offsetTop - hudHeight * 0.275f + offset + (float)Math.Ceiling(26 * _scale) * i)); _sprite.End(); if (time > 0) { _line24.Begin(); _line24.Draw( new[] { new Vector2( offsetRight + hudWidth * 0.23f, offsetTop - hudHeight * 0.28f + offset + (float)Math.Ceiling(26 * _scale) * i), new Vector2( offsetRight + hudWidth * 0.23f + (float)Math.Ceiling(24 * _scale), offsetTop - hudHeight * 0.28f + offset + (float)Math.Ceiling(26 * _scale) * i) }, new Color(0, 0, 0, 175)); _line24.End(); _text14.DrawTextCentered( ((int)time).ToStringLookUp(), new Vector2( offsetRight + hudWidth * 0.359f, offsetTop - hudHeight * 0.28f + offset + (float)Math.Ceiling(26 * _scale) * i), new Color(255, 255, 255, 210), true); } } } _sprite.Begin(SpriteFlags.AlphaBlend); _sprite.DrawCentered( enemy.Texture, new Vector2(offsetRight - hudWidth * 0.1f, offsetTop - hudHeight * 0.13f + offset)); _sprite.DrawCentered( _hudTexture, new Vector2(offsetRight + (float)Math.Ceiling(3 * _scale), offsetTop + offset)); if (enemy.RSpell != null && enemy.RSpell.Level > 0 && enemy.RSpell.CooldownExpires - Game.Time < 0) { _sprite.DrawCentered( _ultimateTexture, new Vector2(offsetRight - hudWidth * 0.34f, offsetTop - hudHeight * 0.375f + offset)); } _sprite.End(); if (enemy.RSpell != null && enemy.RSpell.Level > 0 && enemy.RSpell.CooldownExpires - Game.Time > 0 && enemy.RSpell.CooldownExpires - Game.Time < 100) { _text14.DrawTextCentered( ((int)(enemy.RSpell.CooldownExpires - Game.Time)).ToStringLookUp(), new Vector2(offsetRight - hudWidth * 0.338f, offsetTop - hudHeight * 0.365f + offset), Color.White); } _line17.Begin(); _line17.Draw( new[] { new Vector2(offsetRight - hudWidth * 0.035f, offsetTop + hudHeight * 0.035f + offset), new Vector2( offsetRight - hudWidth * 0.035f + (float)Math.Ceiling(18 * _scale), offsetTop + hudHeight * 0.035f + offset) }, new Color(0, 0, 0, 215)); _line17.End(); _text14.DrawTextCentered( enemy.Unit.Level.ToStringLookUp(), new Vector2(offsetRight + hudWidth * 0.075f, offsetTop + hudHeight * 0.045f + offset), !enemy.Unit.IsVisible || enemy.Unit.IsDead ? new Color(255, 255, 255, 215) : new Color(255, 255, 255, 240)); _text14.DrawTextLeft( enemy.Unit.Name, new Vector2(offsetRight + hudWidth * 0.52f, offsetTop - hudHeight * 0.57f + offset), !enemy.Unit.IsVisible || enemy.Unit.IsDead ? new Color(255, 255, 255, 215) : new Color(255, 255, 255, 240)); var healthStart = new Vector2( offsetRight - hudWidth * 0.358f, offsetTop + hudHeight * 0.268f + offset); var healthWidth = (float)Math.Ceiling(HealthWidth * _scale) / enemy.Unit.MaxHealth * enemy.Unit.Health; _line7.Begin(); _line7.Draw( new[] { healthStart, new Vector2(healthStart.X + healthWidth, healthStart.Y) }, Color.Green); var resStart = new Vector2(healthStart.X, healthStart.Y + (float)Math.Ceiling(9 * _scale)); var resWidth = (float)Math.Ceiling(HealthWidth * _scale); if (!Enumerable.Contains(_champsNoEnergy, enemy.Unit.ChampionName) && enemy.Unit.MaxMana > 0) { resWidth = (float)Math.Ceiling(HealthWidth * _scale) / enemy.Unit.MaxMana * enemy.Unit.Mana; } _line7.Draw( new[] { resStart, new Vector2(resStart.X + resWidth, resStart.Y) }, Enumerable.Contains(_champsEnergy, enemy.Unit.ChampionName) ? Color.Yellow : (Enumerable.Contains(_champsRage, enemy.Unit.ChampionName) ? Color.DarkRed : (Enumerable.Contains(_champsNoEnergy, enemy.Unit.ChampionName) || enemy.Unit.MaxMana <= 0 ? new Color(255, 255, 255, 75) : Color.Blue))); _line7.End(); if (enemy.Unit.IsDead) { _line17.Begin(); _line17.Draw( new[] { new Vector2(offsetRight - hudWidth * 0.36f, offsetTop + hudHeight * 0.338f + offset), new Vector2( offsetRight - hudWidth * 0.36f + (float)Math.Ceiling(HealthWidth * _scale), offsetTop + hudHeight * 0.335f + offset) }, Color.Black); _line17.End(); _text18.DrawTextCentered( ((int)(enemy.DeathEndTime - Game.Time)).ToStringLookUp(), new Vector2(offsetRight + hudWidth * 0.07f, offsetTop + hudHeight * 0.335f + offset), Color.DarkRed); } if (!enemy.Unit.IsVisible || enemy.Unit.IsDead) { _sprite.Begin(SpriteFlags.AlphaBlend); _sprite.DrawCentered( _invisibleTexture, new Vector2(offsetRight - hudWidth * 0.09f, offsetTop - hudHeight * 0.12f + offset)); _sprite.End(); } if (!enemy.Unit.IsDead && !enemy.LastPosition.Equals(Vector3.Zero) && enemy.LastPosition.Distance(enemy.Unit.Position) > 500) { enemy.LastVisible = Game.Time; } enemy.LastPosition = enemy.Unit.Position; if (enemy.Unit.IsVisible || enemy.Unit.IsDead) { enemy.LastVisible = Game.Time; } if (!enemy.Unit.IsVisible && !enemy.Unit.IsDead && Game.Time - enemy.LastVisible > 3) { _text18.DrawTextCentered( ((int)(Game.Time - enemy.LastVisible)).ToStringLookUp(), new Vector2(offsetRight - hudWidth * 0.07f, offsetTop - hudHeight * 0.15f + offset), new Color(255, 255, 255, 215)); } if (enemy.TeleportStatus == Packet.S2C.Teleport.Status.Start || (enemy.TeleportStatus == Packet.S2C.Teleport.Status.Finish || enemy.TeleportStatus == Packet.S2C.Teleport.Status.Abort) && Game.Time <= enemy.LastTeleportStatusTime + 5f) { _sprite.Begin(SpriteFlags.AlphaBlend); _sprite.DrawCentered( enemy.TeleportStatus == Packet.S2C.Teleport.Status.Start ? _teleportStartTexture : (enemy.TeleportStatus == Packet.S2C.Teleport.Status.Finish ? _teleportFinishTexture : _teleportAbortTexture), new Vector2(offsetRight + (float)Math.Ceiling(3 * _scale), offsetTop + offset)); _sprite.End(); } index++; } } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } }