private static void AddNewHeal(Ability item) { if (NameManager.Name(item) != "item_soul_ring") { MyAbilities.DefensiveAbilities.Add(NameManager.Name(item) + "heal", item); } else if (Heals.HealsTogglerCreated && MainMenu.Menu.Item("healsToggler") .GetValue <AbilityToggler>() .Dictionary.ContainsKey(NameManager.Name(item))) { return; } if (!Heals.HealsTogglerCreated) { Heals.HealsTogglerCreated = true; MainMenu.Menu.AddItem( new MenuItem("healsToggler", "Heals:").SetValue(new AbilityToggler(new Dictionary <string, bool>()))); MainMenu.Menu.Item("healsToggler").GetValue <AbilityToggler>().Add(NameManager.Name(item)); MainMenu.AbilitiesMenu.AddSubMenu(Heals.HealsMenu); } else { MainMenu.Menu.Item("healsToggler").GetValue <AbilityToggler>().Add(NameManager.Name(item)); } var menu = HealMenu.Create(NameManager.Name(item)); Heals.HealsMenuDictionary.Add(NameManager.Name(item), menu); Heals.HealsMenu.AddSubMenu(menu); }
public static void UpdateHeroes() { var list = Ensage.Common.Objects.Heroes.GetByTeam(AbilityMain.Me.GetEnemyTeam()); var herolist = new List <Hero>(Heroes); foreach (var hero in list.Where(x => x.IsValid && !x.IsIllusion && x.IsVisible)) { var name = NameManager.Name(hero); var spells = hero.Spellbook.Spells.ToList(); if (!herolist.Contains(hero)) { Heroes.Add(hero); } var abilitylist = spells.Where(x => x.AbilityType != AbilityType.Attribute && x.AbilityType != AbilityType.Hidden) .ToList(); if (AbilityDictionary.ContainsKey(name)) { AbilityDictionary[name] = abilitylist; continue; } AbilityDictionary.Add(name, abilitylist); } }
public static void Update(EventArgs args) { if (!Utils.SleepCheck("HpBar.Update")) { return; } // Utils.Sleep(1, "HpBar.Update"); foreach (var enemyHero in EnemyHeroes.UsableHeroes) { var name = NameManager.Name(enemyHero); if (!HpBarPositionDictionary.ContainsKey(name)) { HpBarPositionDictionary.Add(name, HUDInfo.GetHPbarPosition(enemyHero)); } else { HpBarPositionDictionary[name] = HUDInfo.GetHPbarPosition(enemyHero); } } foreach (var enemyHero in AllyHeroes.UsableHeroes) { var name = NameManager.Name(enemyHero); if (!HpBarPositionDictionary.ContainsKey(name)) { HpBarPositionDictionary.Add(name, HUDInfo.GetHPbarPosition(enemyHero)); } else { HpBarPositionDictionary[name] = HUDInfo.GetHPbarPosition(enemyHero); } } }
public static void Game_OnUpdate(EventArgs args) { if (!OnUpdateChecks.CanUpdate() || !Specials.SpecialsMenuDictionary.ContainsKey("rubick_spell_steal")) { return; } foreach (var hero in EnemyHeroes.Heroes) { var heroName = NameManager.Name(hero); if (!LastCastedDictionary.ContainsKey(heroName)) { LastCastedDictionary.Add(heroName, null); } if (Specials.SpecialsMenuDictionary["rubick_spell_steal"].Item(heroName) == null) { Specials.SpecialsMenuDictionary["rubick_spell_steal"].AddItem( new MenuItem(heroName, hero.ClassID.ToString().Substring("CDOTA_Unit_Hero_".Length) + ":") .SetValue(new AbilityToggler(new Dictionary <string, bool>()))); } if (!EnemyHeroes.AbilityDictionary.ContainsKey(heroName)) { continue; } foreach (var ability in EnemyHeroes.AbilityDictionary[heroName]) { var name = NameManager.Name(ability); if (!CdDictionary.ContainsKey(name)) { CdDictionary.Add(name, false); } var cd = CdDictionary[name]; if ((ability.Cooldown > 0 || (ability.IsAbilityBehavior(AbilityBehavior.Toggle, name) && ability.IsToggled)) && !cd) { CdDictionary[name] = true; LastCastedDictionary[heroName] = ability; } if ((ability.Cooldown <= 0 || (ability.IsAbilityBehavior(AbilityBehavior.Toggle, name) && !ability.IsToggled)) && cd) { CdDictionary[name] = false; } if (ability.IsAbilityBehavior(AbilityBehavior.Passive, name) || name == "invoker_invoke" || name == "invoker_quas" || name == "invoker_wex" || name == "invoker_exort") { continue; } var d = Specials.SpecialsMenuDictionary["rubick_spell_steal"].Item(heroName).GetValue <AbilityToggler>(); if (!d.Dictionary.ContainsKey(name)) { d.Add(name, ability.AbilityType == AbilityType.Ultimate); } } } }
public static void RangeVisible(Ability ability, bool visible, float crange = 0) { var name = NameManager.Name(ability); ParticleEffect range; if (!RangesDictionary.TryGetValue(ability, out range) || RangesDictionary[ability] == null || RangesDictionary[ability].IsDestroyed) { range = AbilityMain.Me.AddParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf"); if (!RangesDictionary.ContainsKey(ability)) { RangesDictionary.Add(ability, range); } else { RangesDictionary[ability] = range; } } var castrange = crange; if (castrange == 0) { castrange = ability.GetCastRange(); } if (!ability.IsAbilityBehavior(AbilityBehavior.NoTarget)) { castrange += Math.Max(castrange / 9, 80); } else { castrange += Math.Max(castrange / 7, 40); } if (visible) { var menu = MainMenu.RangeDrawingMenu.SubMenu(name + "range"); range.SetControlPoint( 1, new Vector3( menu.Item(name + "red").GetValue <Slider>().Value, menu.Item(name + "green").GetValue <Slider>().Value, menu.Item(name + "blue").GetValue <Slider>().Value)); range.SetControlPoint(2, new Vector3(castrange, 255, 0)); range.SetControlPoint(3, new Vector3(10, 0, 0)); return; } RangesDictionary[ability].Dispose(); }
public static void Player_OnExecuteOrder(Player sender, ExecuteOrderEventArgs args) { var ability = args.Ability; if (ability != null && NameManager.Name(ability) == "item_blink") { var blinkPos = args.TargetPosition; if (Me.Distance2D(blinkPos) > 1200) { blinkPos = (blinkPos - Me.Position) * 1200 / blinkPos.Distance2D(Me) + Me.Position; } MyHeroInfo.Position = blinkPos; Utils.Sleep(Game.Ping + Me.GetTurnTime(MyHeroInfo.Position) + 100, "mePosition"); return; } if (ability != null && NameManager.Name(ability) != null) { var hero = args.Target as Hero; if (hero != null && ability.CanHit(hero, NameManager.Name(ability))) { Utils.Sleep(ability.GetCastDelay(Me, hero) * 1000, "GlobalCasting"); Utils.Sleep(ability.GetCastDelay(Me, hero) * 1000, "casting"); return; } if (args.TargetPosition != Vector3.Zero && (ability.GetCastRange() <= Me.Distance2D(args.TargetPosition))) { Utils.Sleep( ability.FindCastPoint() * 1000 + Me.GetTurnTime(args.TargetPosition) * 1000, "GlobalCasting"); Utils.Sleep(ability.FindCastPoint() * 1000 + Me.GetTurnTime(args.TargetPosition) * 1000, "casting"); return; } } if (Utils.SleepCheck("cancelorder")) { // && !MyHeroInfo.IsChanneling()) return; } if (args.TargetPosition != Vector3.Zero && args.Order == Order.MoveLocation) { lastOrderPosition = args.TargetPosition; } args.Process = false; }
public static long GetComboOrder(Ability ability, bool disable) { if (CustomHeroOrderDictionary.ContainsKey(NameManager.Name(AbilityMain.Me)) && CustomHeroOrderDictionary[NameManager.Name(AbilityMain.Me)].ContainsKey(NameManager.Name(ability))) { return(CustomHeroOrderDictionary[NameManager.Name(AbilityMain.Me)][NameManager.Name(ability)]); } if (disable) { return(!DisableOrderDictionary.ContainsKey(NameManager.Name(ability)) ? 4 : DisableOrderDictionary[NameManager.Name(ability)]); } return(!AbilityOrderDictionary.ContainsKey(NameManager.Name(ability)) ? 4 : AbilityOrderDictionary[NameManager.Name(ability)]); }
/// <summary> /// The purification usage. /// </summary> /// <param name="name"> /// The name. /// </param> /// <param name="ability"> /// The ability. /// </param> /// <param name="me"> /// The me. /// </param> /// <param name="ping"> /// The ping. /// </param> /// <param name="handleString"> /// The handle string. /// </param> /// <returns> /// The <see cref="bool" />. /// </returns> private bool PurificationUsage(string name, Ability ability, Hero me, float ping, string handleString) { if (!MainMenu.Menu.Item("nukesToggler").GetValue <AbilityToggler>().IsEnabled(name) || !Nukes.NukesMenuDictionary[name].Item(name + "herotoggler") .GetValue <HeroToggler>() .IsEnabled(NameManager.Name(this.possibleTarget)) || (!(Variables.EtherealHitTime < (Utils.TickCount + (ability.GetHitDelay(this.possibleTarget, name) * 1000)))) || this.possibleTarget.Health <= Nukes.NukesMenuDictionary[name].Item(NameManager.Name(ability) + "minhealthslider") .GetValue <Slider>() .Value) { return(false); } var target = FullCombo.FindPurificationTarget(this.possibleTarget); if (target == null || !(target.PredictedPosition().Distance2D(this.possibleTarget.PredictedPosition()) < ability.GetRadius(name)) || !(target.PredictedPosition() .Distance2D( this.possibleTarget.PredictedPosition(ability.FindCastPoint(NameManager.Name(ability)))) < ability.GetRadius(name))) { return(false); } if (!Nuke.Cast(ability, target, name)) { return(false); } Utils.Sleep( (ability.GetCastDelay(me, this.possibleTarget, abilityName: name) * 1000) + ping + 100, handleString); Utils.Sleep(ability.GetCastDelay(me, this.possibleTarget, abilityName: name) * 1000, "GlobalCasting"); Utils.Sleep(ability.GetHitDelay(this.possibleTarget, name) * 1000, "calculate"); Utils.Sleep( ability.GetCastDelay(me, this.possibleTarget, useCastPoint: false, abilityName: name) * 1000, "casting"); Utils.Sleep(ability.GetCastDelay(me, this.possibleTarget, abilityName: name) * 1000, "cancelorder"); return(true); }
public static void Update(EventArgs args) { if (!OnUpdateChecks.CanUpdate()) { return; } if (Utils.SleepCheck("getheroes") && Heroes.Count < 5) { UpdateHeroes(); Utils.Sleep(1000, "getheroes"); } Heroes = Heroes.Where(x => x.IsValid).ToList(); UsableHeroes = Heroes.Where(x => x.Health > 0 && x.IsAlive && x.IsVisible).ToArray(); if (Utils.SleepCheck("enemyHeroesCheckValid") || UsableHeroes.Any(x => !ItemDictionary.ContainsKey(NameManager.Name(x)))) { Utils.Sleep(2000, "enemyHeroesCheckValid"); var itemList = new List <Item>(Items); foreach (var hero in UsableHeroes) { var name = NameManager.Name(hero); var items = hero.Inventory.Items.ToList(); foreach (var ability in items.Where(x => !itemList.Contains(x) && AbilityDatabase.Find(NameManager.Name(x)) != null) .OrderBy(ComboOrder.GetAbilityOrder)) { Items.Add(ability); } if (ItemDictionary.ContainsKey(name)) { ItemDictionary[name] = items.Where( x => x.AbilityType != AbilityType.Attribute && x.AbilityType != AbilityType.Hidden) .ToList(); continue; } var itemlist = items.Where(x => x.AbilityType != AbilityType.Attribute && x.AbilityType != AbilityType.Hidden) .ToList(); ItemDictionary.Add(name, itemlist); } } }
private static void AddNewSlow(Ability item) { MyAbilities.OffensiveAbilities.Add(NameManager.Name(item) + "slow", item); if (!Slows.SlowsTogglerCreated) { Slows.SlowsTogglerCreated = true; MainMenu.Menu.AddItem( new MenuItem("slowsToggler", "Slows:").SetValue(new AbilityToggler(new Dictionary <string, bool>()))); MainMenu.Menu.Item("slowsToggler").GetValue <AbilityToggler>().Add(NameManager.Name(item)); MainMenu.AbilitiesMenu.AddSubMenu(Slows.SlowsMenu); } else { MainMenu.Menu.Item("slowsToggler").GetValue <AbilityToggler>().Add(NameManager.Name(item)); } var menu = SlowMenu.Create(NameManager.Name(item)); Slows.SlowsMenuDictionary.Add(NameManager.Name(item), menu); Slows.SlowsMenu.AddSubMenu(menu); }
private static void AddNewNuke(Ability item) { MyAbilities.OffensiveAbilities.Add(NameManager.Name(item) + "nuke", item); if (!Nukes.NukesTogglerCreated) { Nukes.NukesTogglerCreated = true; MainMenu.Menu.AddItem( new MenuItem("nukesToggler", "Nukes:").SetValue(new AbilityToggler(new Dictionary <string, bool>()))); MainMenu.Menu.Item("nukesToggler").GetValue <AbilityToggler>().Add(NameManager.Name(item)); MainMenu.AbilitiesMenu.AddSubMenu(Nukes.NukesMenu); } else { MainMenu.Menu.Item("nukesToggler").GetValue <AbilityToggler>().Add(NameManager.Name(item)); } var menu = NukeMenu.Create(NameManager.Name(item)); Nukes.NukesMenuDictionary.Add(NameManager.Name(item), menu); Nukes.NukesMenu.AddSubMenu(menu); }
private static void AddNewBuff(Ability item) { MyAbilities.OffensiveAbilities.Add(NameManager.Name(item) + "buff", item); if (!Buffs.BuffsTogglerCreated) { Buffs.BuffsTogglerCreated = true; MainMenu.Menu.AddItem( new MenuItem("buffsToggler", "Buffs:").SetValue(new AbilityToggler(new Dictionary <string, bool>()))); MainMenu.Menu.Item("buffsToggler").GetValue <AbilityToggler>().Add(NameManager.Name(item)); MainMenu.AbilitiesMenu.AddSubMenu(Buffs.BuffsMenu); } else { MainMenu.Menu.Item("buffsToggler").GetValue <AbilityToggler>().Add(NameManager.Name(item)); } var menu = BuffMenu.Create(NameManager.Name(item)); Buffs.BuffsMenuDictionary.Add(NameManager.Name(item), menu); Buffs.BuffsMenu.AddSubMenu(menu); }
public static void UpdateHeroes() { var list = Ensage.Common.Objects.Heroes.GetByTeam(AbilityMain.Me.Team); var herolist = new List <Hero>(Heroes); var abilityList = new List <Ability>(Abilities.Where(x => x.IsValid)); foreach (var hero in list.Where(x => x.IsValid && x.IsVisible)) { var name = NameManager.Name(hero); var spells = hero.Spellbook.Spells.ToList(); if (!herolist.Contains(hero)) { if (name == "npc_dota_hero_ogre_magi") { Game.PrintMessage( "[ABILITY#]: SpellOverlay is temporary disabled for OgreMagi due to Ensage.Core issues", MessageType.ChatMessage); } Heroes.Add(hero); } if (name == "npc_dota_hero_ogre_magi") { continue; } foreach (var ability in spells.Where(x => !abilityList.Contains(x) && AbilityDatabase.Find(NameManager.Name(x)) != null) .OrderBy(ComboOrder.GetAbilityOrder)) { Abilities.Add(ability); } var abilitylist = spells.Where(x => x.AbilityType != AbilityType.Attribute && x.AbilityType != AbilityType.Hidden) .ToList(); if (AbilityDictionary.ContainsKey(name)) { AbilityDictionary[name] = abilitylist; continue; } AbilityDictionary.Add(name, abilitylist); } }
private static void AddNewSpecial(Ability item, AbilityInfo data) { MyAbilities.OffensiveAbilities.Add(NameManager.Name(item) + "special", item); if (!Specials.SpecialsTogglerCreated) { Specials.SpecialsTogglerCreated = true; MainMenu.Menu.AddItem( new MenuItem("specialsToggler", "Specials:").SetValue( new AbilityToggler(new Dictionary <string, bool>()))); MainMenu.Menu.Item("specialsToggler").GetValue <AbilityToggler>().Add(NameManager.Name(item)); MainMenu.AbilitiesMenu.AddSubMenu(Specials.SpecialsMenu); } else { MainMenu.Menu.Item("specialsToggler").GetValue <AbilityToggler>().Add(NameManager.Name(item)); } var menu = SpecialMenu.Create(NameManager.Name(item)); Specials.SpecialsMenuDictionary.Add(NameManager.Name(item), menu); Specials.SpecialsMenu.AddSubMenu(menu); }
private static void AddNewHarras(Ability item) { MyAbilities.OffensiveAbilities.Add(NameManager.Name(item) + "harras", item); if (!Harrases.HarrasesTogglerCreated) { Harrases.HarrasesTogglerCreated = true; MainMenu.Menu.AddItem( new MenuItem("harrasesToggler", "Harrases:").SetValue( new AbilityToggler(new Dictionary <string, bool>()))); MainMenu.Menu.Item("harrasesToggler").GetValue <AbilityToggler>().Add(NameManager.Name(item)); MainMenu.AbilitiesMenu.AddSubMenu(Harrases.HarrasesMenu); } else { MainMenu.Menu.Item("harrasesToggler").GetValue <AbilityToggler>().Add(NameManager.Name(item)); } var menu = HarrasMenu.Create(NameManager.Name(item)); Harrases.HarrasesMenuDictionary.Add(NameManager.Name(item), menu); Harrases.HarrasesMenu.AddSubMenu(menu); }
public static void Update(EventArgs args) { if (!OnUpdateChecks.CanUpdate()) { return; } if (Utils.SleepCheck("getallyheroes") && Heroes.Count(x => x.IsValid) < 5) { UpdateHeroes(); Utils.Sleep(1000, "getallyheroes"); } Heroes = Heroes.Where(x => x.IsValid).ToList(); UsableHeroes = Heroes.Where(x => x.Health > 0 && x.IsAlive && x.IsVisible).ToArray(); if (Utils.SleepCheck("allyHeroesCheckValid")) { Utils.Sleep(2000, "allyHeroesCheckValid"); foreach (var hero in UsableHeroes) { var name = NameManager.Name(hero); var items = hero.Inventory.Items.ToList(); if (ItemDictionary.ContainsKey(name)) { ItemDictionary[name] = items.Where( x => x.AbilityType != AbilityType.Attribute && x.AbilityType != AbilityType.Hidden) .ToList(); continue; } var itemlist = items.Where(x => x.AbilityType != AbilityType.Attribute && x.AbilityType != AbilityType.Hidden) .ToList(); ItemDictionary.Add(name, itemlist); } } }
public static void UpdateHeroes() { var list = Ensage.Common.Objects.Heroes.GetByTeam(AbilityMain.Me.Team); var herolist = new List <Hero>(Heroes); foreach (var hero in list.Where(x => x.IsValid && !x.IsIllusion && x.IsVisible)) { var name = NameManager.Name(hero); var spells = hero.Spellbook.Spells.ToList(); if (!herolist.Contains(hero)) { // if (name == "npc_dota_hero_ogre_magi") // { // Game.PrintMessage( // "[ABILITY#]: SpellOverlay is temporary disabled for OgreMagi due to Ensage.Core issues", // MessageType.ChatMessage); // } Heroes.Add(hero); } // if (name == "npc_dota_hero_ogre_magi") // { // continue; // } var abilitylist = spells.Where(x => x.AbilityType != AbilityType.Attribute && x.AbilityType != AbilityType.Hidden) .ToList(); if (AbilityDictionary.ContainsKey(name)) { AbilityDictionary[name] = abilitylist; continue; } AbilityDictionary.Add(name, abilitylist); } }
public static long GetDamageOrder(Ability ability) { return(!DamageOrderDictionary.ContainsKey(NameManager.Name(ability)) ? 3 : DamageOrderDictionary[NameManager.Name(ability)]); }
public static void Drawing_OnDraw(EventArgs args) { if (!Game.IsInGame || AbilityMain.Me == null || !AbilityMain.Me.IsValid || EnemyHeroes.Heroes == null) { return; } var enumerable = EnemyHeroes.UsableHeroes; if (!enumerable.Any()) { return; } foreach (var hero in enumerable) { float dmg; if (!Dictionaries.InDamageDictionary.TryGetValue(hero.Handle, out dmg)) { dmg = 0; } float outdmg; if (!Dictionaries.OutDamageDictionary.TryGetValue(hero.Handle, out outdmg)) { outdmg = 0; } var hp = Math.Max(hero.Health - dmg, 0); var lhp = Math.Max(hp - outdmg, 0); var hpperc = hp / hero.MaximumHealth; var dmgperc = Math.Min(dmg, hero.Health) / hero.MaximumHealth; Vector2 hbarpos; HpBar.HpBarPositionDictionary.TryGetValue(NameManager.Name(hero), out hbarpos); if (hbarpos.X + 20 > HUDInfo.ScreenSizeX() || hbarpos.X - 20 < 0 || hbarpos.Y + 100 > HUDInfo.ScreenSizeY() || hbarpos.Y - 30 < 0) { continue; } var hpvarx = HpBar.SizeX; var hpbary = HpBar.SizeY; var position = hbarpos + new Vector2(hpvarx * hpperc, (float)(hpbary * 0.4)); if (MainMenu.DamageIndicatorMenu.Item("abilityDamageIndicatorDrawDamage").GetValue <bool>()) { if (dmg > 0) { Drawing.DrawRect( position, new Vector2(hpvarx * dmgperc, (float)(hpbary / 1.6)), (lhp > 0) ? new Color(225, 200, 150, 95) : new Color(70, 225, 70, 105)); Drawing.DrawRect( position, new Vector2(hpvarx * dmgperc, (float)(hpbary / 1.6)), Color.Black, true); } if (outdmg > 0) { var outdmgperc = Math.Min(outdmg, hp) / hero.MaximumHealth; var pos = position + new Vector2(-hpvarx * outdmgperc, 0); Drawing.DrawRect( pos, new Vector2(hpvarx * outdmgperc, (float)(hpbary / 1.6)), (lhp > 0) ? new Color(100, 0, 0, 200) : new Color(0, 120, 0, 200)); Drawing.DrawRect( pos, new Vector2(hpvarx * outdmgperc, (float)(hpbary / 1.6)), Color.Black, true); } } if (MainMenu.DamageIndicatorMenu.Item("abilityDamageIndicatorDrawHits").GetValue <bool>()) { double hits; if (!Dictionaries.HitsDictionary.TryGetValue(hero.Handle.ToString(), out hits)) { continue; } var textt = hits.ToString(CultureInfo.InvariantCulture) + ((hits > 1) ? " hits" : " hit"); var hpbarpositionX = HUDInfo.GetHPbarPosition(hero).X; var s = ((hits > 0) ? textt : "KILL"); var h = "(" + Math.Floor(hero.Health - dmg - outdmg) + ")"; var isi = MainMenu.DamageIndicatorMenu.Item("abilityDamageIndicatorTextSize").GetValue <Slider>().Value; var textSize = Drawing.MeasureText( s, "Arial", new Vector2(hpbary + 4 + isi, 1), FontFlags.AntiAlias); var textPos = new Vector2( (int) (hpbarpositionX + 4 + (HpBar.SizeX * ((float)hero.Health * 1000 / hero.MaximumHealth)) / 1000), (int)(HUDInfo.GetHPbarPosition(hero).Y - 2)); Drawing.DrawText( s, textPos, new Vector2(hpbary + 4 + isi, 1), (hits > 0) ? Color.White : new Color(100, 225, 110), FontFlags.AntiAlias); Drawing.DrawText( h, textPos + new Vector2(textSize.X + 2, 1), new Vector2(hpbary + 2 + isi, 1), (hits > 0) ? Color.LightGoldenrodYellow : Color.YellowGreen, FontFlags.AntiAlias); } } }
public static void OnUpdate(EventArgs args) { if (!OnUpdateChecks.CanUpdate()) { return; } if (!Utils.SleepCheck("DamageUpdate") || !Utils.SleepCheck("GlobalCasting")) { return; } Utils.Sleep(100, "DamageUpdate"); foreach (var hero in new List <Hero>(EnemyHeroes.Heroes).Where(x => x != null && x.IsValid && x.IsAlive && x.IsVisible)) { var heroName = NameManager.Name(hero); var heroHandle = hero.Handle; if (Utils.SleepCheck("calculate")) { var enumerable = MyAbilities.OffensiveAbilities.Where( ability => ability.Value.IsValid && ability.Key.Contains("nuke") && Nukes.NukesMenuDictionary[NameManager.Name(ability.Value)].Item( NameManager.Name(ability.Value) + "herotoggler") .GetValue <HeroToggler>() .IsEnabled(heroName) && MainMenu.Menu.Item("nukesToggler") .GetValue <AbilityToggler>() .IsEnabled(NameManager.Name(ability.Value)) && Nukes.NukesMenuDictionary[NameManager.Name(ability.Value)].Item( NameManager.Name(ability.Value) + "combo").GetValue <bool>()) .OrderBy(x => ComboOrder.GetDamageOrder(x.Value)) .ToList(); float[] intakenDamage = { 0 }; var minusMagicResistancePerc = 0f; var tempList = new List <Ability>(); float[] outtakenDamage = { 0 }; var manaLeft = AbilityMain.Me.Mana; foreach (var ability in enumerable.Where( ability => (ability.Value.CanBeCasted() || ability.Value.IsInAbilityPhase || (AbilityMain.Me.ClassID == ClassID.CDOTA_Unit_Hero_Invoker && MyAbilities.InvokerInvoke.CanBeCasted() && ability.Value.Cooldown <= 0.5 && ability.Value.ManaCost + MyAbilities.InvokerInvoke.ManaCost < manaLeft))) .Select(data => data.Value)) { var name = NameManager.Name(ability); if (manaLeft < ability.ManaCost || manaLeft < Nukes.NukesMenuDictionary[name].Item(name + "minManaCheck").GetValue <Slider>().Value) { continue; } manaLeft -= ability.ManaCost; if (DamageAmps.IsDamageAmp(ability)) { minusMagicResistancePerc += DamageAmps.DamageAmpValue(ability); } float tempdmg; if (ability.CanHit(hero, MyHeroInfo.Position)) { tempdmg = AbilityDamage.CalculateDamage( ability, AbilityMain.Me, hero, minusHealth: intakenDamage[0] + outtakenDamage[0], minusMagicResistancePerc: minusMagicResistancePerc); intakenDamage[0] += tempdmg; tempList.Add(ability); if (!Dictionaries.InDamageDictionary.ContainsKey(heroHandle)) { Dictionaries.InDamageDictionary.Add(heroHandle, intakenDamage[0]); } else { Dictionaries.InDamageDictionary[heroHandle] = intakenDamage[0]; } if (intakenDamage[0] >= hero.Health) { MyAbilities.NukesCombo = tempList; AbilityMain.DealtDamage = 0; break; } } else { tempdmg = AbilityDamage.CalculateDamage( ability, AbilityMain.Me, hero, minusHealth: outtakenDamage[0] + intakenDamage[0], minusMagicResistancePerc: minusMagicResistancePerc); outtakenDamage[0] += tempdmg; } } if (!Dictionaries.OutDamageDictionary.ContainsKey(heroHandle)) { Dictionaries.OutDamageDictionary.Add(heroHandle, outtakenDamage[0]); } else { Dictionaries.OutDamageDictionary[heroHandle] = outtakenDamage[0]; } if (!Dictionaries.InDamageDictionary.ContainsKey(heroHandle)) { Dictionaries.InDamageDictionary.Add(heroHandle, intakenDamage[0]); } else { Dictionaries.InDamageDictionary[heroHandle] = intakenDamage[0]; } } float dmg; if (!Dictionaries.InDamageDictionary.TryGetValue(heroHandle, out dmg)) { dmg = 0; } float outdmg; if (!Dictionaries.OutDamageDictionary.TryGetValue(heroHandle, out outdmg)) { outdmg = 0; } var hp = Math.Max(hero.Health - dmg, 0); var lhp = Math.Max(hp - outdmg, 0); float hitDmg; if (!Dictionaries.HitDamageDictionary.TryGetValue(heroHandle, out hitDmg)) { hitDmg = hero.DamageTaken( MyDamage.BonusDamage + MyDamage.MinDamage, DamageType.Physical, AbilityMain.Me); Dictionaries.HitDamageDictionary.Add(heroHandle, hitDmg); } else { hitDmg = hero.DamageTaken( MyDamage.BonusDamage + MyDamage.MinDamage, DamageType.Physical, AbilityMain.Me); Dictionaries.HitDamageDictionary[heroHandle] = hitDmg; Utils.Sleep(250, heroHandle + "updatehitdamage"); } var currentHits = lhp / hitDmg; double hits; if (!Dictionaries.HitsDictionary.TryGetValue(heroHandle.ToString(), out hits)) { hits = Math.Ceiling( (currentHits * MyHeroInfo.AttackRate() * hero.HealthRegeneration + lhp) / hitDmg); Dictionaries.HitsDictionary.Add(heroHandle.ToString(), hits); } else if (Utils.SleepCheck(heroHandle + "updatehits")) { hits = Math.Ceiling( (currentHits * MyHeroInfo.AttackRate() * hero.HealthRegeneration + lhp) / hitDmg); Dictionaries.HitsDictionary[heroHandle.ToString()] = hits; Utils.Sleep(250, heroHandle + "updatehits"); } } }
public static void AddRange(Ability ability, float crange = 0) { var name = NameManager.Name(ability); if (RangesDictionary.ContainsKey(ability)) { return; } var castrange = crange; if (castrange == 0) { castrange = ability.GetCastRange(); } if (!ability.IsAbilityBehavior(AbilityBehavior.NoTarget)) { castrange += Math.Max(castrange / 9, 80); } else { castrange += Math.Max(castrange / 7, 40); } //var list = new[] { "selected_ring", "drag_selected_ring", "hero_underglow" }; var menu = new Menu(name, name + "range", false, name); menu.AddItem(new MenuItem(name + "rangeenable", "Show range")).SetValue(false).ValueChanged += (sender, args) => { RangeVisible(ability, args.GetNewValue <bool>()); }; menu.AddItem(new MenuItem(name + "red", "Red:")) .SetFontStyle(fontColor: Color.Red) .SetValue(new Slider(100, 0, 255)) .ValueChanged += (sender, args) => { if (RangesDictionary.ContainsKey(ability)) { RangesDictionary[ability].SetControlPoint( 1, new Vector3( args.GetNewValue <Slider>().Value, menu.Item(name + "green").GetValue <Slider>().Value, menu.Item(name + "blue").GetValue <Slider>().Value)); } }; menu.AddItem(new MenuItem(name + "green", "Green:")) .SetFontStyle(fontColor: Color.Green) .SetValue(new Slider(100, 0, 255)) .ValueChanged += (sender, args) => { if (RangesDictionary.ContainsKey(ability)) { RangesDictionary[ability].SetControlPoint( 1, new Vector3( menu.Item(name + "red").GetValue <Slider>().Value, args.GetNewValue <Slider>().Value, menu.Item(name + "blue").GetValue <Slider>().Value)); } }; menu.AddItem(new MenuItem(name + "blue", "Blue:")) .SetFontStyle(fontColor: Color.Blue) .SetValue(new Slider(100, 0, 255)) .ValueChanged += (sender, args) => { if (RangesDictionary.ContainsKey(ability)) { RangesDictionary[ability].SetControlPoint( 1, new Vector3( menu.Item(name + "red").GetValue <Slider>().Value, menu.Item(name + "green").GetValue <Slider>().Value, args.GetNewValue <Slider>().Value)); } }; MainMenu.RangeDrawingMenu.AddSubMenu(menu); var range = AbilityMain.Me.AddParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf"); if (menu.Item(name + "rangeenable").GetValue <bool>()) { range.SetControlPoint( 1, new Vector3( menu.Item(name + "red").GetValue <Slider>().Value, menu.Item(name + "green").GetValue <Slider>().Value, menu.Item(name + "blue").GetValue <Slider>().Value)); range.SetControlPoint(2, new Vector3(castrange, 255, 0)); range.SetControlPoint(3, new Vector3(10, 0, 0)); } else { range.Dispose(); } RangesValueDictionary.Add(name, castrange); RangesDictionary.Add(ability, range); }
public static long GetAbilityOrder(Ability ability) { return(!AbilityOrderDictionary.ContainsKey(NameManager.Name(ability)) ? 4 : AbilityOrderDictionary[NameManager.Name(ability)]); }
public static void ObjectMgr_OnRemoveEntity(EntityEventArgs args) { try { var a = args.Entity; if (a == null || NameManager.Name(a) == null || MainMenu.Menu == null) { return; } var name = NameManager.Name(a); var data = AbilityDatabase.Find(name); if (data == null || a.Owner == null || !a.Owner.Equals(AbilityMain.Me)) { return; } MainMenu.ComboKeysMenu.Item("comboAbilitiesToggler").GetValue <AbilityToggler>().Remove(name); MainMenu.ComboKeysMenu.Item("Ability#.ComboOrder").GetValue <PriorityChanger>().Remove(name); // if (AbilityMain.Me.ClassId == ClassId.CDOTA_Unit_Hero_Rubick) // { // if (!Rubick.MyCdDictionary.ContainsKey(name)) // { // Rubick.MyCdDictionary.Add(name, Utils.TickCount + ((a as Ability).Cooldown * 1000)); // } // } RangeDrawing.RemoveRange(a as Ability); if (data.IsPurge || data.WeakensEnemy || data.TrueSight) { MainMenu.Menu.Item("specialsToggler").GetValue <AbilityToggler>().Remove(name); Specials.SpecialsMenuDictionary.Remove(name); Specials.SpecialsMenu.RemoveSubMenu(name); MyAbilities.OffensiveAbilities.Remove(name + "special"); } if (data.IsBuff) { MainMenu.Menu.Item("buffsToggler").GetValue <AbilityToggler>().Remove(name); Buffs.BuffsMenuDictionary.Remove(name); Buffs.BuffsMenu.RemoveSubMenu(name); MyAbilities.OffensiveAbilities.Remove(name + "buff"); } if (data.IsNuke || name == "item_urn_of_shadows") { MainMenu.Menu.Item("nukesToggler").GetValue <AbilityToggler>().Remove(name); Nukes.NukesMenuDictionary.Remove(name); Nukes.NukesMenu.RemoveSubMenu(name); MyAbilities.OffensiveAbilities.Remove(name + "nuke"); } if (data.IsDisable) { MainMenu.Menu.Item("disablesToggler").GetValue <AbilityToggler>().Remove(name); Disables.DisablesMenuDictionary.Remove(name); Disables.DisablesMenu.RemoveSubMenu(name); MyAbilities.OffensiveAbilities.Remove(name + "disable"); } if (data.IsSlow) { MainMenu.Menu.Item("slowsToggler").GetValue <AbilityToggler>().Remove(name); Slows.SlowsMenuDictionary.Remove(name); Slows.SlowsMenu.RemoveSubMenu(name); MyAbilities.OffensiveAbilities.Remove(name + "slow"); } if (data.IsHarras) { MainMenu.Menu.Item("harrasesToggler").GetValue <AbilityToggler>().Remove(name); Harrases.HarrasesMenuDictionary.Remove(name); Harrases.HarrasesMenu.RemoveSubMenu(name); MyAbilities.OffensiveAbilities.Remove(name + "harras"); } if (data.IsSilence) { MainMenu.Menu.Item("silencesToggler").GetValue <AbilityToggler>().Remove(name); Silences.SilencesMenuDictionary.Remove(name); Silences.SilencesMenu.RemoveSubMenu(name); MyAbilities.OffensiveAbilities.Remove(name + "silence"); } if (data.IsHeal) { MainMenu.Menu.Item("healsToggler").GetValue <AbilityToggler>().Remove(name); Heals.HealsMenuDictionary.Remove(name); Heals.HealsMenu.RemoveSubMenu(name); MyAbilities.DefensiveAbilities.Remove(name + "heal"); } if (data.IsShield) { MainMenu.Menu.Item("shieldsToggler").GetValue <AbilityToggler>().Remove(name); Shields.ShieldsMenuDictionary.Remove(name); Shields.ShieldsMenu.RemoveSubMenu(name); MyAbilities.DefensiveAbilities.Remove(name + "shield"); } } catch (Exception e) { Console.WriteLine(e.ToString()); } }
public static void UpdateItems(EventArgs args) { if (!OnUpdateChecks.CanUpdate()) { return; } try { if (!Utils.SleepCheck("checkitems")) { return; } foreach (var item in AbilityMain.Me.Inventory.Items) { switch (NameManager.Name(item)) { case "item_gem": continue; case "item_soul_ring": MyAbilities.SoulRing = item; break; case "item_aether_lens": RangeDrawing.Update(); break; case "item_cyclone": MyAbilities.Cyclone = item; break; case "item_force_staff": MyAbilities.ForceStaff = item; break; case "item_blink": if (MyAbilities.Blink != null && MyAbilities.Blink.IsValid) { continue; } ComboMenu.AddAbility(item.StoredName(), item); RangeDrawing.AddRange(item); MyAbilities.Blink = item; continue; } var data = AbilityDatabase.Find(NameManager.Name(item)); if (data == null) { continue; } if (!MyAbilities.OffensiveAbilities.ContainsValue(item)) { var added = false; if (data.IsSlow) { AddNewSlow(item); added = true; } if (data.IsHarras) { AddNewHarras(item); added = true; } if (data.IsBuff) { AddNewBuff(item); added = true; } if (data.IsSilence) { AddNewSilence(item); added = true; } if (data.TrueSight || data.WeakensEnemy || data.IsPurge) { AddNewSpecial(item, data); added = true; } if (data.IsDisable) { AddNewDisable(item); added = true; } if (data.IsNuke || item.Name == "item_urn_of_shadows") { AddNewNuke(item); added = true; } if (added) { RangeDrawing.AddRange(item); ComboMenu.AddAbility(item.Name, item); } } // Console.WriteLine(!MyAbilities.DefensiveAbilities.ContainsValue(item) + " " + NameManager.Name(item) + " " + data.IsHeal); if (!MyAbilities.DefensiveAbilities.ContainsValue(item)) { if (data.IsHeal) { AddNewHeal(item); } if (data.IsShield) { AddNewShield(item); } } } if (AbilityMain.Me.ClassId == ClassId.CDOTA_Unit_Hero_Rubick) { foreach (var item in AllyHeroes.AbilityDictionary[NameManager.Name(AbilityMain.Me)]) { var data = AbilityDatabase.Find(NameManager.Name(item)); if (data == null) { continue; } if (item.StoredName() == "spirit_breaker_charge_of_darkness") { MyAbilities.ChargeOfDarkness = item; } if (!MyAbilities.OffensiveAbilities.ContainsValue(item)) { var added = false; if (data.IsSlow) { AddNewSlow(item); added = true; } if (data.IsHarras) { AddNewHarras(item); added = true; } if (data.IsBuff) { AddNewBuff(item); added = true; } if (data.IsSilence) { AddNewSilence(item); added = true; } if (data.TrueSight || data.WeakensEnemy || data.IsPurge) { AddNewSpecial(item, data); added = true; } if (data.IsDisable) { AddNewDisable(item); added = true; } if (data.IsNuke) { AddNewNuke(item); added = true; } if (added) { ComboMenu.AddAbility(item.Name, item); } } // Console.WriteLine(!MyAbilities.DefensiveAbilities.ContainsValue(item) + " " + NameManager.Name(item) + " " + data.IsHeal); if (!MyAbilities.DefensiveAbilities.ContainsValue(item)) { if (data.IsHeal) { AddNewHeal(item); } if (data.IsShield) { AddNewShield(item); } } } } Utils.Sleep(1000, "checkitems"); } catch (Exception e) { Console.WriteLine(e.ToString()); } }
public static void Drawing_OnDraw(EventArgs args) { if (!Game.IsInGame || AbilityMain.Me == null || !AbilityMain.Me.IsValid || EnemyHeroes.Heroes == null) { return; } if (Utils.SleepCheck("AbilityOverlay.Update")) { boxSizeX = HpBar.SizeX / 6 + MainMenu.AbilityOverlayMenu.Item("sizeSliderSpell").GetValue <Slider>().Value; boxSizeY = boxSizeX + 1; boxExtraPosX = MainMenu.AbilityOverlayMenu.Item("ExtraPosSliderSpellX").GetValue <Slider>().Value *(float)0.5; boxExtraPosY = MainMenu.AbilityOverlayMenu.Item("ExtraPosSliderSpellY").GetValue <Slider>().Value *(float)0.5; itemBoxSizeX = HpBar.SizeX / 6 + MainMenu.AbilityOverlayMenu.Item("sizeSliderItem").GetValue <Slider>().Value; itemBoxSizeY = (float)(itemBoxSizeX / 1.24); itemboxExtraPosX = MainMenu.AbilityOverlayMenu.Item("ExtraPosSliderItemX").GetValue <Slider>().Value *(float)0.5; itemboxExtraPosY = MainMenu.AbilityOverlayMenu.Item("ExtraPosSliderItemY").GetValue <Slider>().Value *(float)0.5; Utils.Sleep(100, "AbilityOverlay.Update"); } var size = new Vector2(HpBar.SizeX, (float)(HpBar.SizeY / 2.8)); var spellOverlayEnabledEnemy = MainMenu.AbilityOverlayMenu.Item("enableSpellOverlayEnemy").GetValue <bool>(); var enableManaBar = MainMenu.ManaBarMenu.Item("enableManaBar").GetValue <bool>(); try { foreach (var hero in EnemyHeroes.UsableHeroes) { var heroName = NameManager.Name(hero); var mana = hero.Mana; var maxMana = hero.MaximumMana; var hpbarpos = HpBar.HpBarPositionDictionary[heroName]; if (hpbarpos.X + 20 > HUDInfo.ScreenSizeX() || hpbarpos.X - 20 < 0 || hpbarpos.Y + 100 > HUDInfo.ScreenSizeY() || hpbarpos.Y - 30 < 0) { continue; } if (enableManaBar) { var start = hpbarpos + new Vector2(0, HpBar.SizeY + 1); var manaperc = mana / maxMana; Drawing.DrawRect(start, size + new Vector2(1, 1), new Color(0, 0, 50, 150)); Drawing.DrawRect(start, new Vector2(size.X * manaperc, size.Y), new Color(70, 120, 220)); Drawing.DrawRect(start + new Vector2(-1, -1), size + new Vector2(3, 3), Color.Black, true); } if (EnemyHeroes.AbilityDictionary.ContainsKey(heroName) && spellOverlayEnabledEnemy) { var abilities = EnemyHeroes.AbilityDictionary[heroName].Where( x => (int)x.AbilitySlot >= 0 && (int)x.AbilitySlot <= 5) .OrderBy(x => (int)x.AbilitySlot); var defaultPos = hpbarpos + new Vector2( HpBar.SizeX / 2 - Math.Max((abilities.Count() / 2) * boxSizeX, HpBar.SizeX / 2), HpBar.SizeY + size.Y + 3); var position = defaultPos + new Vector2(boxExtraPosX, boxExtraPosY); foreach (var ability in abilities) { DrawAbilityOverlay(ability, position, heroName, mana); position += new Vector2(boxSizeX, 0); } } if (MainMenu.AbilityOverlayMenu.Item("enableItemOverlayEnemy").GetValue <bool>()) { if (!EnemyHeroes.ItemDictionary.ContainsKey(heroName)) { continue; } var items = EnemyHeroes.ItemDictionary[heroName].Where(ability => ability.IsValid).ToList(); var itemPos = hpbarpos - new Vector2( -HpBar.SizeX / 2 + Math.Max((items.Count / 2) * itemBoxSizeX, HpBar.SizeX / 2), itemBoxSizeY); var ItemPosExtra = itemPos + new Vector2(itemboxExtraPosX, itemboxExtraPosY); foreach (var ability in items) { DrawItemOverlay(ability, ItemPosExtra, mana); ItemPosExtra += new Vector2(itemBoxSizeX, 0); } } } } catch (EntityNotFoundException e) { EnemyHeroes.UpdateHeroes(); Console.WriteLine(e.ToString()); } var spellOverlayEnabledAlly = MainMenu.AbilityOverlayMenu.Item("enableSpellOverlayAlly").GetValue <bool>(); try { foreach (var hero in AllyHeroes.UsableHeroes) { var heroName = NameManager.Name(hero); var mana = hero.Mana; var hpbarpos = HpBar.HpBarPositionDictionary[heroName]; if (hpbarpos.X + 20 > HUDInfo.ScreenSizeX() || hpbarpos.X - 20 < 0 || hpbarpos.Y + 100 > HUDInfo.ScreenSizeY() || hpbarpos.Y - 30 < 0) { continue; } if (spellOverlayEnabledAlly && AllyHeroes.AbilityDictionary.ContainsKey(heroName)) { var abilities = AllyHeroes.AbilityDictionary[heroName].Where( x => (int)x.AbilitySlot >= 0 && (int)x.AbilitySlot <= 5) .OrderBy(x => (int)x.AbilitySlot); var defaultPos = hpbarpos + new Vector2( HpBar.SizeX / 2 - Math.Max((abilities.Count() / 2) * boxSizeX, HpBar.SizeX / 2), HpBar.SizeY + size.Y + 3); if (hero.Equals(AbilityMain.Me)) { defaultPos += new Vector2(-3, 3); } var position = defaultPos + new Vector2(boxExtraPosX, boxExtraPosY); foreach (var ability in abilities) { DrawAbilityOverlay(ability, position, heroName, mana); position += new Vector2(boxSizeX, 0); } } if (MainMenu.AbilityOverlayMenu.Item("enableItemOverlayAlly").GetValue <bool>()) { if (!AllyHeroes.ItemDictionary.ContainsKey(heroName)) { continue; } var items = AllyHeroes.ItemDictionary[heroName].Where(ability => ability.IsValid).ToList(); var itemPos = hpbarpos - new Vector2( -HpBar.SizeX / 2 + Math.Max((items.Count / 2) * itemBoxSizeX, HpBar.SizeX / 2), itemBoxSizeY); var ItemPosExtra = itemPos + new Vector2(itemboxExtraPosX, itemboxExtraPosY); if (hero.Equals(AbilityMain.Me)) { ItemPosExtra += new Vector2(-3, 1); } foreach (var ability in items) { DrawItemOverlay(ability, ItemPosExtra, mana); ItemPosExtra += new Vector2(itemBoxSizeX, 0); } } } } catch (EntityNotFoundException e) { AllyHeroes.UpdateHeroes(); Console.WriteLine(e.ToString()); } }
private static void DrawItemOverlay(Item ability, Vector2 position, float mana) { try { var name = NameManager.Name(ability); var enoughMana = mana >= ability.ManaCost; DotaTexture texture; if (!TextureDictionary.TryGetValue(name, out texture)) { texture = Textures.GetTexture("materials/ensage_ui/items/" + name.Substring("item_".Length) + ".vmat"); TextureDictionary.Add(name, texture); } Drawing.DrawRect( position + new Vector2(1, 0), new Vector2((float)(itemBoxSizeX + itemBoxSizeX / 2.6), itemBoxSizeY), texture); var cooldown = Math.Ceiling(ability.Cooldown); if (cooldown > 0 || !enoughMana) { Drawing.DrawRect( position + new Vector2(1, 0), new Vector2(itemBoxSizeX - 1, itemBoxSizeY), enoughMana ? new Color(40, 40, 40, 180) : new Color(25, 25, 130, 190)); } else { Drawing.DrawRect( position + new Vector2(1, 0), new Vector2(itemBoxSizeX - 1, itemBoxSizeY), new Color(0, 0, 0, 100)); } if (cooldown > 0) { var h = Math.Min(cooldown, 99).ToString(CultureInfo.InvariantCulture); var hsize = cooldown > 9 ? new Vector2(Math.Min(itemBoxSizeY - 1, 15), 15) : new Vector2(Math.Min(itemBoxSizeY + 1, 15), 25); var textSize = Drawing.MeasureText(h, "Arial", hsize, FontFlags.AntiAlias); var pos = position + new Vector2(itemBoxSizeX / 2 - textSize.X / 2, (itemBoxSizeY / 2) - (textSize.Y / 2)); Drawing.DrawText(h, pos, hsize, Color.WhiteSmoke, FontFlags.AntiAlias); } if (!enoughMana && cooldown <= 0) { var h = Math.Min(Math.Ceiling(ability.ManaCost - mana), 999).ToString(CultureInfo.InvariantCulture); var textSize = Drawing.MeasureText( h, "Arial", new Vector2(Math.Min(itemBoxSizeY - 2, 15), 1), FontFlags.AntiAlias); var pos = position + new Vector2(itemBoxSizeX / 2 - textSize.X / 2, (itemBoxSizeY / 2) - (textSize.Y / 2)); Drawing.DrawText( h, pos, new Vector2(Math.Min(itemBoxSizeY - 2, 15), 1), Color.LightBlue, FontFlags.AntiAlias); } if ((ability.IsRequiringCharges || NameManager.Name(ability) == "item_ward_dispenser" || NameManager.Name(ability) == "item_ward_observer" || NameManager.Name(ability) == "item_ward_sentry") && cooldown <= 0) { var s = ability.CurrentCharges.ToString(); var tSize = new Vector2(Math.Min(itemBoxSizeY - 2, 15), 1); var textSize = Drawing.MeasureText(s, "Arial", tSize, FontFlags.AntiAlias); var tPos = position + new Vector2(itemBoxSizeX - textSize.X - 2, itemBoxSizeY - textSize.Y - 1); Drawing.DrawRect( tPos - new Vector2(1, 0), new Vector2(textSize.X + 1, textSize.Y + 1), new Color(0, 0, 0, 220)); Drawing.DrawText(s, tPos, tSize, new Color(168, 168, 168), FontFlags.AntiAlias | FontFlags.StrikeOut); var secondcharges = ability.SecondaryCharges; if (secondcharges > 0) { tPos = position + new Vector2(2, itemBoxSizeY - textSize.Y - 1); s = secondcharges.ToString(); tSize = new Vector2(Math.Min(itemBoxSizeY - 2, 15), 1); var textSize1 = Drawing.MeasureText(s, "Arial", tSize, FontFlags.AntiAlias); Drawing.DrawRect( tPos - new Vector2(1, 0), new Vector2(textSize1.X + 1, textSize1.Y + 1), new Color(0, 0, 0, 220)); Drawing.DrawText( s, tPos, tSize, new Color(168, 168, 168), FontFlags.AntiAlias | FontFlags.StrikeOut); } } } catch (Exception) { // ignored } Drawing.DrawRect(position, new Vector2(itemBoxSizeX + 1, itemBoxSizeY), Color.Black, true); }
private static void DrawAbilityOverlay(Ability ability, Vector2 position, string heroName, float mana) { var name = NameManager.Name(ability); var level = ability.Level; var isInvoker = heroName == "npc_dota_hero_invoker"; var color = new Color(168, 168, 168); var enoughMana = mana >= ability.ManaCost; var notinvospell = !isInvoker || (ability.AbilitySlot != AbilitySlot.Slot_4 && ability.AbilitySlot != AbilitySlot.Slot_5); DotaTexture texture; if (!TextureDictionary.TryGetValue(name, out texture)) { texture = Textures.GetTexture("materials/ensage_ui/spellicons/" + name + ".vmat"); TextureDictionary.Add(name, texture); } Drawing.DrawRect(position + new Vector2(1, 0), new Vector2(boxSizeX, boxSizeY), texture); var cooldown = Math.Ceiling(ability.Cooldown); if (cooldown > 0 || !enoughMana || level <= 0) { Drawing.DrawRect( position + new Vector2(1, 0), new Vector2(boxSizeX - 1, boxSizeY), level <= 0 ? new Color(10, 10, 10, 210) : (enoughMana ? new Color(40, 40, 40, 180) : new Color(25, 25, 130, 190))); } else { Drawing.DrawRect( position + new Vector2(1, 0), new Vector2(boxSizeX - 1, boxSizeY), new Color(0, 0, 0, 100)); } if (notinvospell) { var s = level.ToString(); var textSize = Drawing.MeasureText(s, "Arial", new Vector2(boxSizeX / 2, 1), FontFlags.AntiAlias); Drawing.DrawRect( position + new Vector2(1, 0), new Vector2(textSize.X + 2, textSize.Y + 1), new Color(0, 0, 0, 220)); Drawing.DrawText( s, position + new Vector2(1, 0), new Vector2(boxSizeX / 2, 1), color, FontFlags.AntiAlias | FontFlags.StrikeOut); } if (cooldown > 0) { var h = Math.Min(cooldown, 99).ToString(CultureInfo.InvariantCulture); var hsize = cooldown > 9 ? new Vector2(boxSizeX / 2 + 3, 15) : new Vector2(boxSizeX / 2 + 5, 25); var textSize = Drawing.MeasureText(h, "Arial", hsize, FontFlags.AntiAlias); Vector2 pos; if (!notinvospell) { pos = position + new Vector2(boxSizeX / 2 - textSize.X / 2, (boxSizeY / 2) - (textSize.Y / 2)); } else { pos = position + new Vector2((float)(boxSizeX / 1.5 - textSize.X / 2), (boxSizeY / 2) - (textSize.Y / 2)); } if (cooldown < 10) { pos += new Vector2(1, 0); } Drawing.DrawText(h, pos, hsize, Color.WhiteSmoke, FontFlags.AntiAlias); } if (!enoughMana && cooldown <= 0) { var h = Math.Min(Math.Ceiling(ability.ManaCost - mana), 999).ToString(CultureInfo.InvariantCulture); var textSize = Drawing.MeasureText(h, "Arial", new Vector2(boxSizeX / 2 + 1, 1), FontFlags.AntiAlias); Vector2 pos; if (!notinvospell) { pos = position + new Vector2(boxSizeX / 2 - textSize.X / 2, (float)((boxSizeY / 1.5) - (textSize.Y / 2))); } else { pos = position + new Vector2( (float)(boxSizeX / 1.5 - textSize.X / 2), (float)((boxSizeY / 1.5) - (textSize.Y / 2))); } Drawing.DrawText(h, pos, new Vector2(boxSizeX / 2 + 1, 1), Color.LightBlue, FontFlags.AntiAlias); } Drawing.DrawRect(position, new Vector2(boxSizeX + 1, boxSizeY), Color.Black, true); }
public static void UpdateDamage(Hero[] enemyHeroes, Hero[] allyHeroes) { if (!Utils.SleepCheck("GankDamage.Update")) { return; } if (!OnUpdateChecks.CanUpdate() || !MainMenu.GankDamageMenu.Item("enableGankDamage").GetValue <bool>()) { return; } enemies = enemyHeroes; allies = allyHeroes; Utils.Sleep(1000, "GankDamage.Update"); if (MainMenu.GankDamageMenu.Item("enableGankDamageEnemies").GetValue <bool>()) { foreach (var enemyHero in enemyHeroes) { var hero = enemyHero; var heroName = NameManager.Name(hero); if (!IncomingDamages.ContainsKey(heroName)) { IncomingDamages.Add(heroName, 0); } var tempDmg = 0f; foreach (var allyHero in allyHeroes.Where( x => AllyHeroes.AbilityDictionary.ContainsKey(NameManager.Name(x)) && AllyHeroes.ItemDictionary.ContainsKey(NameManager.Name(x)) && x.Distance2D(hero) < 1700)) { var abilities = AllyHeroes.AbilityDictionary[NameManager.Name(allyHero)]; var items = AllyHeroes.ItemDictionary[NameManager.Name(allyHero)].Where(x => x.IsValid).ToList(); var list = new List <Ability>(abilities.Count + items.Count); list.AddRange(abilities); list.AddRange(items); tempDmg += list.Where(x => x.CanBeCasted()) .Sum(ability => AbilityDamage.CalculateDamage(ability, allyHero, hero)); } IncomingDamages[heroName] = tempDmg; } } if (!MainMenu.GankDamageMenu.Item("enableGankDamageAllies").GetValue <bool>()) { return; } foreach (var allyHero in allyHeroes) { var hero = allyHero; var heroName = NameManager.Name(hero); if (!IncomingDamages.ContainsKey(heroName)) { IncomingDamages.Add(heroName, 0); } var tempDmg = 0f; foreach (var enemyHero in enemyHeroes.Where( x => EnemyHeroes.AbilityDictionary.ContainsKey(NameManager.Name(x)) && EnemyHeroes.ItemDictionary.ContainsKey(NameManager.Name(x)) && x.Distance2D(hero) < 1700)) { var abilities = EnemyHeroes.AbilityDictionary[NameManager.Name(enemyHero)]; var items = EnemyHeroes.ItemDictionary[NameManager.Name(enemyHero)].Where(x => x.IsValid).ToList(); var list = new List <Ability>(abilities.Count + items.Count); list.AddRange(abilities); list.AddRange(items); tempDmg += list.Where(x => x.CanBeCasted()) .Sum(ability => AbilityDamage.CalculateDamage(ability, enemyHero, hero)); } IncomingDamages[heroName] = tempDmg; } }
public static void Drawing_OnDraw(EventArgs args) { if (!Game.IsInGame || !allies.Any() || !enemies.Any() || !IncomingDamages.Any() || AbilityMain.Me == null || !AbilityMain.Me.IsValid || !MainMenu.GankDamageMenu.Item("enableGankDamage").GetValue <bool>()) { return; } if (MainMenu.GankDamageMenu.Item("enableGankDamageAllies").GetValue <bool>()) { foreach (var ally in allies.Where(x => x != null && IncomingDamages.ContainsKey(NameManager.Name(x)))) { var health = ally.Health; var maxHealth = ally.MaximumHealth; var allyName = NameManager.Name(ally); var hpleft = Math.Max(health - IncomingDamages[allyName], 0); var hpperc = hpleft / maxHealth; var dmgperc = Math.Min(IncomingDamages[allyName], health) / maxHealth; Vector2 hbarpos; HpBar.HpBarPositionDictionary.TryGetValue(allyName, out hbarpos); if (hbarpos.X + 20 > HUDInfo.ScreenSizeX() || hbarpos.X - 20 < 0 || hbarpos.Y + 100 > HUDInfo.ScreenSizeY() || hbarpos.Y - 30 < 0) { continue; } var hpvarx = HpBar.SizeX; var hpbary = HpBar.SizeY; var position = hbarpos + new Vector2(hpvarx * hpperc, 0); Drawing.DrawRect( position, new Vector2(hpvarx * dmgperc, (float)(hpbary * 0.4)), (hpleft > 0) ? new Color(190, 150, 130, 100) : new Color(225, 70, 70, 200)); Drawing.DrawRect(position, new Vector2(hpvarx * dmgperc, (float)(hpbary * 0.4)), Color.Black, true); } } if (!MainMenu.GankDamageMenu.Item("enableGankDamageEnemies").GetValue <bool>()) { return; } foreach (var enemy in enemies.Where(x => x != null && IncomingDamages.ContainsKey(NameManager.Name(x)))) { var health = enemy.Health; var maxHealth = enemy.MaximumHealth; var enemyName = NameManager.Name(enemy); var hpleft = Math.Max(health - IncomingDamages[enemyName], 0); var hpperc = hpleft / maxHealth; var dmgperc = Math.Min(IncomingDamages[enemyName], health) / maxHealth; Vector2 hbarpos; HpBar.HpBarPositionDictionary.TryGetValue(enemyName, out hbarpos); if (hbarpos.X + 20 > HUDInfo.ScreenSizeX() || hbarpos.X - 20 < 0 || hbarpos.Y + 100 > HUDInfo.ScreenSizeY() || hbarpos.Y - 30 < 0) { continue; } var hpvarx = HpBar.SizeX; var hpbary = HpBar.SizeY; var position = hbarpos + new Vector2(hpvarx * hpperc, 0); Drawing.DrawRect( position, new Vector2(hpvarx * dmgperc, (float)(hpbary * 0.4)), (hpleft > 0) ? new Color(150, 225, 150, 80) : new Color(70, 225, 150, 225)); Drawing.DrawRect(position, new Vector2(hpvarx * dmgperc, (float)(hpbary * 0.4)), Color.Black, true); } }
public static void AddAllToMenu() { var mySpells = AbilityMain.Me.Spellbook.Spells.Where(x => AbilityDatabase.Find(x.Name) != null); var myItems = AbilityMain.Me.Inventory.Items; var spells = mySpells as Ability[] ?? mySpells.ToArray(); var myItems1 = myItems as Item[] ?? myItems.ToArray(); var blink = myItems1.FirstOrDefault(x => x.Name == "item_blink"); MyAbilities.SoulRing = myItems1.FirstOrDefault(x => x.Name == "item_soul_ring"); if (blink != null) { MyAbilities.Blink = blink; RangeDrawing.AddRange(blink); } Nukes.AddAllNukes(spells, myItems1); Disables.AddAllDisables(spells, myItems1); Slows.AddAllSlows(spells, myItems1); Buffs.AddAllBuffs(spells, myItems1); Harrases.AddAllHarrases(spells, myItems1); Silences.AddAllSilences(spells, myItems1); Specials.AddAllSpecials(spells, myItems1); Heals.AddAllHeals(spells, myItems1); Shields.AddAllShields(spells, myItems1); MainMenu.Menu.AddSubMenu(MainMenu.AbilitiesMenu); MainMenu.DrawingsMenu.AddSubMenu(MainMenu.DamageIndicatorMenu); MainMenu.DrawingsMenu.AddSubMenu(MainMenu.GankDamageMenu); MainMenu.GankDamageMenu.AddItem(new MenuItem("enableGankDamage", "Enable: ").SetValue(true)); MainMenu.GankDamageMenu.AddItem( new MenuItem("enableGankDamageAllies", "Enable for allies: ").SetValue(true)); MainMenu.GankDamageMenu.AddItem( new MenuItem("enableGankDamageEnemies", "Enable for enemies: ").SetValue(true)); MainMenu.DamageIndicatorMenu.AddItem( new MenuItem("abilityDamageIndicatorDrawDamage", "Draw Damage").SetValue(true)); MainMenu.DamageIndicatorMenu.AddItem( new MenuItem("abilityDamageIndicatorDrawHits", "Draw hits").SetValue(true)); MainMenu.DamageIndicatorMenu.AddItem( new MenuItem("abilityDamageIndicatorTextSize", "Increase text size").SetValue(new Slider(0, 0, 5))); MainMenu.DrawingsMenu.AddSubMenu(MainMenu.AbilityOverlayMenu); MainMenu.AbilityOverlayMenu.AddItem( new MenuItem("spellOverlay", "SPELLS OVERLAY:").SetFontStyle(fontColor: Color.White)); MainMenu.AbilityOverlayMenu.AddItem( new MenuItem("enableSpellOverlayEnemy", "Enable for enemies: ").SetValue(true)); MainMenu.AbilityOverlayMenu.AddItem( new MenuItem("enableSpellOverlayAlly", "Enable for allies: ").SetValue(true)); MainMenu.AbilityOverlayMenu.AddItem( new MenuItem("sizeSliderSpell", "Increase the size: ").SetValue(new Slider(0, 0, 25))); MainMenu.AbilityOverlayMenu.AddItem( new MenuItem("itemOverlay", "ITEMS OVERLAY:").SetFontStyle(fontColor: Color.White)); MainMenu.AbilityOverlayMenu.AddItem( new MenuItem("enableItemOverlayEnemy", "Enable for enemies: ").SetValue(true)); MainMenu.AbilityOverlayMenu.AddItem( new MenuItem("enableItemOverlayAlly", "Enable for allies: ").SetValue(true)); MainMenu.AbilityOverlayMenu.AddItem( new MenuItem("sizeSliderItem", "Increase the size: ").SetValue(new Slider(0, 0, 25))); MainMenu.ComboKeysMenu.AddItem(new MenuItem("unfinishedFeature", "This feature is currently unfinished!")) .SetFontStyle(fontColor: Color.OrangeRed) .SetTooltip("Contains unfinished stuff, not all combos are tweaked/in right order."); MainMenu.ComboKeysMenu.AddItem(new MenuItem("abilityKey1", "Combo Key")) .SetValue(new KeyBind('G', KeyBindType.Press)); MainMenu.ComboKeysMenu.AddItem(new MenuItem("abilityComboType", "Combo Order")) .SetValue(new StringList(new[] { "Normal", "Maximum Disable", "Maximum Damage" })); MainMenu.ComboKeysMenu.AddItem(new MenuItem("Ability.KeyCombo.Mode", "Move mode")) .SetValue(new StringList(new[] { "Orbwalk", "Move to mouse", "Attack target", "Do nothing" })); MainMenu.ComboKeysMenu.AddItem(new MenuItem("Ability.KeyCombo.NoMoveRange", "No move range")) .SetValue(new Slider(0, 0, 300)) .SetTooltip("Your hero will not move if you put your mouse near your hero in the selected range"); MainMenu.ComboKeysMenu.AddItem(new MenuItem("Ability.KeyCombo.Target", "Target selection")) .SetValue(new StringList(new[] { "ClosestToMouse", "FastestKillable" })); MainMenu.ComboKeysMenu.AddItem(new MenuItem("Ability.KeyCombo.TargetLock", "Target lock")) .SetValue(new StringList(new[] { "None", "WhenTheyGoToFog", "WhenKeyIsPressed" })); MainMenu.ComboKeysMenu.AddItem(new MenuItem("comboAbilitiesToggler", "Abilities in combo: ")) .SetValue(new AbilityToggler(new Dictionary <string, bool>())); foreach (var spell in from spell in spells let data = AbilityDatabase.Find(spell.Name) where (data != null && (data.IsNuke || data.IsDisable || data.IsHarras || data.IsBuff || data.WeakensEnemy || data.IsSlow || data.IsSilence)) || spell.Name == "tinker_rearm" select spell) { var dv = spell.AbilityType != AbilityType.Ultimate || spell.Name == "templar_assassin_psionic_trap"; if (NameManager.Name(spell) == "tinker_rearm") { MyAbilities.TinkerRearm = spell; } ComboMenu.AddAbility(spell.Name, dv); } foreach (var spell in from spell in myItems1 let data = AbilityDatabase.Find(spell.Name) where data != null && (data.IsNuke || data.IsDisable || data.IsHarras || data.IsBuff || data.WeakensEnemy || data.IsSlow || data.IsSilence) select spell) { ComboMenu.AddAbility(spell.Name); } // if (blink != null) // { // MainMenu.ComboKeysMenu.Item("comboAbilitiesToggler").GetValue<AbilityToggler>().Add(blink.Name); // } MainMenu.OptionsMenu.AddSubMenu(MainMenu.ComboKeysMenu); MainMenu.OptionsMenu.AddSubMenu(MainMenu.DrawingsMenu); MainMenu.Menu.AddSubMenu(MainMenu.OptionsMenu); MainMenu.Menu.AddSubMenu(MainMenu.RangeDrawingMenu); }