private static void DrawingOnEndScene(EventArgs args) { try { if (Drawing.Direct3DDevice == null || Drawing.Direct3DDevice.IsDisposed || !Utils.ShouldDraw()) { return; } if (_line != null && !_line.IsDisposed) { if (_menu == null || !_menu.Item(_menu.Name + ".enabled").GetValue <bool>()) { return; } var color = _menu.Item(_menu.Name + ".color").GetValue <Color>(); var alpha = (byte)(_menu.Item(_menu.Name + ".opacity").GetValue <Slider>().Value * 255 / 100); var sharpColor = new ColorBGRA(color.R, color.G, color.B, alpha); foreach (var unit in GameObjects.EnemyHeroes.Where( u => u.IsHPBarRendered && u.Position.IsOnScreen() && u.IsValidTarget())) { var damage = CalculateDamage(unit); if (damage <= 0) { continue; } var damagePercentage = (unit.Health - damage > 0 ? unit.Health - damage : 0) / unit.MaxHealth; var currentHealthPercentage = unit.Health / unit.MaxHealth; var startPoint = new Vector2( (int)(unit.HPBarPosition.X + BarOffset.X + damagePercentage * BarWidth), (int)(unit.HPBarPosition.Y + BarOffset.Y) - 5); var endPoint = new Vector2( (int)(unit.HPBarPosition.X + BarOffset.X + currentHealthPercentage * BarWidth) + 1, (int)(unit.HPBarPosition.Y + BarOffset.Y) - 5); _line.Begin(); _line.Draw(new[] { startPoint, endPoint }, sharpColor); _line.End(); } } } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } }
public static void UseFleeItems() { if (_menu == null || !_menu.Item(_menu.Name + ".enabled").GetValue <bool>()) { return; } try { foreach (var item in Items.Where( i => i.Flags.HasFlag(ItemFlags.Flee) && _menu.Item(_menu.Name + "." + i.Name + ".flee").GetValue <bool>() && i.Item.IsOwned() && i.Item.IsReady() && i.Item.IsOwned() && i.Item.IsReady() && ObjectManager.Player.CountEnemiesInRange(i.Range) >= _menu.Item(_menu.Name + "." + i.Name + ".min-enemies-range").GetValue <Slider>().Value&& ObjectManager.Player.HealthPercent <= _menu.Item(_menu.Name + "." + i.Name + ".player-health-below").GetValue <Slider>().Value&& ObjectManager.Player.HealthPercent >= _menu.Item(_menu.Name + "." + i.Name + ".player-health-above").GetValue <Slider>().Value)) { if (item.CastType != CastType.None) { var lItem = item; var localItem = item; foreach (var enemy in GameObjects.EnemyHeroes.Where( t => t.IsValidTarget() && !Invulnerable.Check(t) && t.HealthPercent <= _menu.Item(_menu.Name + "." + lItem.Name + ".target-health-below") .GetValue <Slider>() .Value&& t.HealthPercent >= _menu.Item(_menu.Name + "." + lItem.Name + ".target-health-above") .GetValue <Slider>() .Value) .OrderByDescending( t => t.Position.Distance(ObjectManager.Player.Position, true) < Math.Pow(localItem.Range, 2))) { if (!Utils.IsImmobile(enemy) && !Utils.IsSlowed(enemy)) { switch (localItem.CastType) { case CastType.Target: localItem.Item.Cast(enemy); break; case CastType.Self: localItem.Item.Cast(ObjectManager.Player); break; case CastType.Position: var prediction = Prediction.GetPrediction( enemy, localItem.Delay, localItem.Radius, localItem.Speed); if (prediction.Hitchance >= HitChance.Medium) { localItem.Item.Cast(prediction.CastPosition); } break; } } } } else { if (ObjectManager.Player.CountEnemiesInRange(item.Range) > _menu.Item(_menu.Name + "." + item.Name + ".min-enemies-range").GetValue <Slider>().Value) { item.Item.Cast(); } } } } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } }
public Menu AddToMenu(Menu menu) { try { _menu = menu; var ultimateMenu = menu.AddSubMenu(new Menu("Ultimate", menu.Name + ".ultimate")); if (Required) { var requiredMenu = ultimateMenu.AddSubMenu(new Menu("Required Targets", ultimateMenu.Name + ".required")); var modes = new List <UltimateModeType>(); if (Combo) { modes.Add(UltimateModeType.Combo); } if (Auto) { modes.Add(UltimateModeType.Auto); } if (Assisted) { modes.Add(UltimateModeType.Assisted); } requiredMenu.AddItem( new MenuItem(requiredMenu.Name + ".mode", "Mode").SetValue( new StringList(modes.Select(m => m.ToString()).ToArray()))).ValueChanged += delegate(object sender, OnValueChangeEventArgs eventArgs) { Utils.UpdateVisibleTags(requiredMenu, eventArgs.GetNewValue <StringList>().SelectedIndex + 1); }; for (var i = 0; i < modes.Count; i++) { requiredMenu.AddItem( new MenuItem( requiredMenu.Name + "." + GetModeString(modes[i], true) + ".min", "Min. Required") .SetValue(new Slider(1, 1, 5))).SetTag(i + 1); HeroListManager.AddToMenu( requiredMenu, new HeroListManagerArgs("ultimate-required-" + GetModeString(modes[i], true)) { IsWhitelist = true, Allies = false, Enemies = true, DefaultValue = false, DontSave = true, Enabled = true, MenuTag = i + 1, EnabledButton = false }); } Utils.UpdateVisibleTags( requiredMenu, _menu.Item(requiredMenu.Name + ".mode").GetValue <StringList>().SelectedIndex + 1); } if (Force) { var uForceMenu = ultimateMenu.AddSubMenu(new Menu("Forced Targets", ultimateMenu.Name + ".force")); if (DamageCalculation != null) { uForceMenu.AddItem( new MenuItem(uForceMenu.Name + ".damage-check", "Damage Check").SetValue(ForceDamageCheck)); } uForceMenu.AddItem( new MenuItem(uForceMenu.Name + ".additional", "Additional Targets").SetValue( new Slider(0, 0, 4))); HeroListManager.AddToMenu( uForceMenu, new HeroListManagerArgs("ultimate-force") { IsWhitelist = true, Allies = false, Enemies = true, DefaultValue = false, DontSave = true, Enabled = true, EnabledButton = false }); } if (Combo) { var uComboMenu = ultimateMenu.AddSubMenu(new Menu("Combo", ultimateMenu.Name + ".combo")); uComboMenu.AddItem( new MenuItem(uComboMenu.Name + ".min", "Min. Hits").SetValue(new Slider(2, 1, 5))); if (DamageCalculation != null) { uComboMenu.AddItem( new MenuItem(uComboMenu.Name + ".damage-check", "Damage Check").SetValue(ComboDamageCheck)); } uComboMenu.AddItem(new MenuItem(uComboMenu.Name + ".enabled", "Enabled").SetValue(true)); } if (Auto) { var uAutoMenu = ultimateMenu.AddSubMenu(new Menu("Auto", ultimateMenu.Name + ".auto")); if (Interrupt) { var autoInterruptMenu = uAutoMenu.AddSubMenu(new Menu("Interrupt", uAutoMenu.Name + ".interrupt")); if (InterruptDelay) { DelayManager.AddToMenu( autoInterruptMenu, "ultimate-interrupt-delay", string.Empty, 0, 0, 500); } HeroListManager.AddToMenu( autoInterruptMenu, new HeroListManagerArgs("ultimate-interrupt") { IsWhitelist = false, Allies = false, Enemies = true, DefaultValue = false, DontSave = false, Enabled = true }); } if (Gapcloser) { var autoGapcloserMenu = uAutoMenu.AddSubMenu(new Menu("Gapcloser", uAutoMenu.Name + ".gapcloser")); if (GapcloserDelay) { DelayManager.AddToMenu( autoGapcloserMenu, "ultimate-gapcloser-delay", string.Empty, 0, 0, 500); } HeroListManager.AddToMenu( autoGapcloserMenu, new HeroListManagerArgs("ultimate-gapcloser") { IsWhitelist = false, Allies = false, Enemies = true, DefaultValue = false, DontSave = false, Enabled = false }); BestTargetOnlyManager.AddToMenu(autoGapcloserMenu, "r-gapcloser", true); } uAutoMenu.AddItem(new MenuItem(uAutoMenu.Name + ".min", "Min. Hits").SetValue(new Slider(3, 1, 5))); if (DamageCalculation != null) { uAutoMenu.AddItem( new MenuItem(uAutoMenu.Name + ".damage-check", "Damage Check").SetValue(AutoDamageCheck)); } uAutoMenu.AddItem(new MenuItem(uAutoMenu.Name + ".enabled", "Enabled").SetValue(true)); } if (Assisted) { var uAssistedMenu = ultimateMenu.AddSubMenu(new Menu("Assisted", ultimateMenu.Name + ".assisted")); if (Flash) { uAssistedMenu.AddItem( new MenuItem(ultimateMenu.Name + ".flash.min", "Flash Min. Hits").SetValue( new Slider(3, 1, 5))); } uAssistedMenu.AddItem( new MenuItem(uAssistedMenu.Name + ".min", "Min. Hits").SetValue(new Slider(1, 1, 5))); if (Flash) { uAssistedMenu.AddItem( new MenuItem(ultimateMenu.Name + ".flash.hotkey", "Flash").SetValue( new KeyBind('Y', KeyBindType.Press))); } uAssistedMenu.AddItem( new MenuItem(uAssistedMenu.Name + ".hotkey", "Hotkey").SetValue( new KeyBind('T', KeyBindType.Press))); uAssistedMenu.AddItem( new MenuItem(uAssistedMenu.Name + ".move-cursor", "Move to Cursor").SetValue(true)); if (DamageCalculation != null) { uAssistedMenu.AddItem( new MenuItem(uAssistedMenu.Name + ".damage-check", "Damage Check").SetValue( AssistedDamageCheck)); } uAssistedMenu.AddItem(new MenuItem(uAssistedMenu.Name + ".enabled", "Enabled").SetValue(true)); } var uSingleMenu = ultimateMenu.AddSubMenu(new Menu("Single Target", ultimateMenu.Name + ".single")); uSingleMenu.AddItem( new MenuItem(uSingleMenu.Name + ".min-health", "Min. Target Health %").SetValue(new Slider(15))); uSingleMenu.AddItem( new MenuItem(uSingleMenu.Name + ".max-add-allies", "Max. Additional Allies").SetValue( new Slider(3, 0, 4))); uSingleMenu.AddItem( new MenuItem(uSingleMenu.Name + ".max-add-enemies", "Max. Additional Enemies").SetValue( new Slider(0, 0, 4))); uSingleMenu.AddItem( new MenuItem(uSingleMenu.Name + ".range-allies", "Allies Range Check").SetValue( new Slider(1750, 500, 3000))); uSingleMenu.AddItem( new MenuItem(uSingleMenu.Name + ".range-enemies", "Enemies Range Check").SetValue( new Slider(1750, 500, 3000))); if (Combo) { uSingleMenu.AddItem(new MenuItem(uSingleMenu.Name + ".combo", "Combo").SetValue(true)); } if (Auto) { uSingleMenu.AddItem(new MenuItem(uSingleMenu.Name + ".auto", "Auto").SetValue(false)); } if (Assisted) { if (Flash) { uSingleMenu.AddItem(new MenuItem(uSingleMenu.Name + ".flash", "Flash").SetValue(false)); } uSingleMenu.AddItem(new MenuItem(uSingleMenu.Name + ".assisted", "Assisted").SetValue(false)); } if (DamageCalculation != null) { ultimateMenu.AddItem( new MenuItem(ultimateMenu.Name + ".damage-percent-single", "Single Damage Check %").SetValue( new Slider(SingleDamagePercent, 1, 200))); ultimateMenu.AddItem( new MenuItem(ultimateMenu.Name + ".damage-percent", "Damage Check %").SetValue( new Slider(DamagePercent, 1, 200))); } return(ultimateMenu); } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } return(null); }