public HeroOverlay(Config config) { Config = config; var panel = Config.Factory.Menu("Hero Overlay"); var manaBars = panel.Menu("ManaBars"); ManaBars = manaBars.Item("Enable", true); ManaBarsForAlly = manaBars.Item("Enable for ally", true); ManaBarsForEnemy = manaBars.Item("Enable for enemy", true); ManaBarsNumbers = manaBars.Item("Draw value", true); ManaBarsSize = manaBars.Item("Size", new Slider(12, 5, 20)); var abilityOverlay = panel.Menu("Ability overlay"); AbilityOverlay = abilityOverlay.Item("Enable", true); AbilityLevelTextSize = abilityOverlay.Item("Ability Level text size", new Slider(5, 2, 10)); AbilityCooldownTextSize = abilityOverlay.Item("Ability Cooldown/ManaCost text size", new Slider(6, 2, 10)); AbilitySize = abilityOverlay.Item("Size", new Slider(7, 1, 20)); var itemOverlay = panel.Menu("Item overlay"); ItemOverlay = itemOverlay.Item("Enable", true); ItemDrawCharges = itemOverlay.Item("Draw charges", true); ItemDangItems = itemOverlay.Item("Danger items only", false); ItemTextSize = itemOverlay.Item("Cooldown/ManaCost text size", new Slider(10, 2, 10)); ItemSize = itemOverlay.Item("Size", new Slider(7, 1, 20)); ItemBorderClr = itemOverlay.Item("Border color", new StringList("white", "black")); Drawing.OnDraw += DrawingOnOnDraw; HealthBarSize = new Vector2(HudInfo.GetHPBarSizeX(), HudInfo.GetHpBarSizeY()); }
public HeroOverlay(Config config) { Config = config; var panel = Config.Factory.Menu("Hero Overlay"); EnableForMainHero = panel.Item("Enable for main hero", true); EnableForAllyHeroes = panel.Item("Enable for ally heroes", true); ExtraPositionX = panel.Item("Extra position X", new Slider(0, -50, 50)); ExtraPositionY = panel.Item("Extra position Y", new Slider(0, -50, 50)); ExtraSizeX = panel.Item("Extra size X", new Slider(0, -50, 50)); ExtraSizeY = panel.Item("Extra size Y", new Slider(0, -50, 50)); var healthBars = panel.Menu("HealthBar"); HealthBar = healthBars.Item("Enable", true); DrawMaxHealth = healthBars.Item("Draw max health", true); HealthBarTextSize = healthBars.Item("Size", new Slider(12, 5, 20)); var manaBars = panel.Menu("ManaBars"); ManaBars = manaBars.Item("Enable", true); ManaBarsForAlly = manaBars.Item("Enable for ally", true); ManaBarsForEnemy = manaBars.Item("Enable for enemy", true); ManaBarsNumbers = manaBars.Item("Draw value", true); ManaBarsSize = manaBars.Item("Size", new Slider(12, 5, 20)); var abilityOverlay = panel.Menu("Ability overlay"); AbilityOverlay = abilityOverlay.Item("Enable", true); AbilityLevelTextSize = abilityOverlay.Item("Ability Level text size", new Slider(5, 2, 10)); AbilityCooldownTextSize = abilityOverlay.Item("Ability Cooldown/ManaCost text size", new Slider(6, 2, 10)); AbilitySize = abilityOverlay.Item("Size", new Slider(7, 1, 20)); var itemOverlay = panel.Menu("Item overlay"); ItemOverlay = itemOverlay.Item("Enable", true); ItemDrawCharges = itemOverlay.Item("Draw charges", true); ItemDangItems = itemOverlay.Item("Danger items only", false); ItemInvisBreakItems = itemOverlay.Item("Invis Breaker items only", false); ItemInvisBreakItems.Item.SetTooltip("gem, dust, sentry"); ItemTextSize = itemOverlay.Item("Cooldown/ManaCost text size", new Slider(10, 2, 10)); ItemSize = itemOverlay.Item("Size", new Slider(7, 1, 20)); ItemBorderClr = itemOverlay.Item("Border color", new StringList("white", "black")); Drawing.OnDraw += DrawingOnOnDraw; HealthBarSize = new Vector2(HudInfo.GetHPBarSizeX(), HudInfo.GetHpBarSizeY()); }
private void DrawAction(List <CourContainer> cours) { foreach (var cour in cours) { var hero = cour.Cour; if (!hero.IsAlive) { continue; } if (!hero.IsVisible) { continue; } var pos = HudInfo.GetHPbarPosition(hero); if (pos.IsZero) { continue; } var size = new Vector2(HudInfo.GetHPBarSizeX(hero), HudInfo.GetHpBarSizeY(hero)); var tempSize = size.X * ItemSize / 30f; var abilitySize = new Vector2(tempSize); var abilities = cour.Items; var abilityCount = abilities.Count; pos += new Vector2(0, size.Y - 2); pos += new Vector2((size.X - tempSize * abilityCount) / 2f, -abilitySize.Y); foreach (var ability in abilities) { if (ability == null || !ability.IsValid) { continue; } pos = DrawItemState(pos, ability, abilitySize, Color.White); } } }
private void DrawingOnOnDraw(EventArgs args) { var heroes = Config.Main.Updater.Heroes; var itemBorderWhite = ItemBorderClr.Value.SelectedIndex == 0; foreach (var heroCont in heroes) { if (!EnableForMainHero && heroCont.IsOwner) { continue; } var hero = heroCont.Hero; if (!hero.IsAlive) { continue; } if (!hero.IsVisible) { continue; } var hpBarPos = HudInfo.GetHPbarPosition(hero); var pos = hpBarPos + new Vector2(ExtraPositionX, ExtraPositionY); if (pos.IsZero) { continue; } var copy = pos; var size = new Vector2(HudInfo.GetHPBarSizeX(hero) + ExtraSizeX, HudInfo.GetHpBarSizeY(hero) + ExtraSizeY); if (HealthBar) { if (!heroCont.IsAlly) { var health = DrawMaxHealth ? $"{hero.Health}/{heroCont.MaxHealth}" : $"{hero.Health}"; DrawingHelper.DrawHealthBar(pos, size, health, HealthBarTextSize); } } if (heroCont.IsOwner) { pos += new Vector2(-1, size.Y); size -= new Vector2(1, 0); } else { pos += new Vector2(0, size.Y - 2); } if (ManaBars) { if (heroCont.IsAlly && ManaBarsForAlly || !heroCont.IsAlly && ManaBarsForEnemy) { var mana = heroCont.Mana; pos = DrawingHelper.DrawManaBar(pos, mana * size.X / heroCont.MaxMana, size, new Color(0, 155, 255, 255), new Color(0, 0, 0, 255), ((int)mana).ToString(), ManaBarsNumbers, ManaBarsSize.Value.Value); } } if (AbilityOverlay) { var tempSize = size.X * AbilitySize / 30f; var abilitySize = new Vector2(tempSize); //IEnumerable<Ability> abilities = heroCont.Abilities; //var enumerable = abilities as Ability[] ?? abilities.ToArray(); //var abilityCount = abilities.Count(); var abilities = heroCont.Abilities2.Where(x => x.IsValid && !x.IsHidden).ToList(); var abilityCount = abilities.Count; //var extraAbilitites = abilityCount - 4; pos += new Vector2((size.X - tempSize * abilityCount) / 2f, 0); /*if (extraAbilitites > 0) * { * pos -= new Vector2(abilitySize.X * extraAbilitites / 2f, 0); * }*/ /*foreach (var ability in abilities) * { * if (ability == null || !ability.IsValid || ability.IsHidden) * { * heroCont.RefreshAbilities(); * continue; * } * pos = DrawAbilityState(pos, ability, abilitySize); * }*/ try { foreach (var ability in abilities.OrderBy(x => x.AbilitySlot)) { pos = DrawAbilityState(pos, ability, abilitySize); } } catch (Exception) { // ignored } } if (ItemOverlay) { var tempSize = size.X * ItemSize / 30f; var abilitySize = new Vector2(tempSize); var abilities = ItemDangItems ? heroCont.DangItems : heroCont.Items; var abilityCount = abilities.Count; //var extraAbilitites = abilityCount - 4; pos = copy; pos += new Vector2((size.X - tempSize * abilityCount) / 2f, -abilitySize.Y); /*if (extraAbilitites > 0) * { * //pos -= new Vector2(abilitySize.X * extraAbilitites / 2f, 0); * * }*/ foreach (var ability in abilities) { if (ability == null || !ability.IsValid) { continue; } pos = DrawItemState(pos, ability, abilitySize, itemBorderWhite ? Color.White : Color.Black); } } } }