public UnitIconDrawer(IAbilityUnit unit) { this.Unit = unit; var name = this.Unit.SourceUnit.Name.Substring("npc_dota_hero_".Length); this.Icon = unit.SourceUnit is Hero?Textures.GetHeroRoundTexture(this.Unit.Name) : null; this.MinimapIcon = unit.SourceUnit is Hero?Textures.GetTexture("ensage_ui/miniheroes/" + name) : null; this.WorldIconSize = new Vector2(HUDInfo.GetHpBarSizeY() * 6); var icon = (Bitmap)Resources.ResourceManager.GetObject(name); if (icon == null) { Console.WriteLine("Ability#: could not find " + name + " minimap icon"); } else { this.EndSceneIcon = new Render.Sprite(icon, new Vector2(100, 700)); } this.MinimapIconSize = new Vector2((float)(HUDInfo.GetHpBarSizeY() * 1.5)); this.EndSceneIcon.SetSaturation(1.5f); // sprite.Add(); }
public KillableCourier(Unit unit) : base(unit) { HpBarSize = new Vector2(HUDInfo.GetHPBarSizeX(Unit) - 12, HUDInfo.GetHpBarSizeY(Unit) / 2); DefaultTextureY = -50; UnitType = UnitType.Courier; }
/// <summary> /// Initializes a new instance of the <see cref="GreaterBash" /> class. /// </summary> /// <param name="ability"> /// The ability. /// </param> public GreaterBash(Ability ability) { this.ability = ability; this.unsuccessfulAttackCount = 1; this.abilityIcon = Drawing.GetTexture("materials/ensage_ui/spellicons/spirit_breaker_greater_bash"); this.iconSize = new Vector2(HUDInfo.GetHpBarSizeY() * 2); }
private static void DrawTarget() { HeroIcon = Drawing.GetTexture("materials/ensage_ui/miniheroes/skywrath_mage"); IconSize = new Vector2(HUDInfo.GetHpBarSizeY() * 2); if ( !Drawing.WorldToScreen(Target.Position + new Vector3(0, 0, Target.HealthBarOffset / 3f), out ScreenPosition)) { return; } ScreenPosition += new Vector2(-IconSize.X, 0); Drawing.DrawRect(ScreenPosition, IconSize, HeroIcon); if (Circle == null) { Circle = new ParticleEffect(@"particles\ui_mouseactions\range_finder_tower_aoe.vpcf", Target); Circle.SetControlPoint(2, Me.Position); Circle.SetControlPoint(6, new Vector3(1, 0, 0)); Circle.SetControlPoint(7, Target.Position); } else { Circle.SetControlPoint(2, Me.Position); Circle.SetControlPoint(6, new Vector3(1, 0, 0)); Circle.SetControlPoint(7, Target.Position); } }
private static void Drawing_OnDraw(EventArgs args) { if (!Checker.IsActive()) { return; } if (!IsEnable) { return; } foreach (var v in Manager.HeroManager.GetEnemyViableHeroes()) { try { var pos = HUDInfo.GetHPbarPosition(v); if (pos.IsZero) { continue; } pos += new Vector2(0, HUDInfo.GetHpBarSizeY() - 2); var size = new Vector2(HUDInfo.GetHPBarSizeX(), HUDInfo.GetHpBarSizeY() * ManaBarSize); var manaDelta = new Vector2(v.Mana * size.X / v.MaximumMana, 0); Drawing.DrawRect(pos, size, Color.Black); Drawing.DrawRect(pos, new Vector2(manaDelta.X, size.Y), new Color(R, G, B, 255)); Drawing.DrawRect(pos, size, Color.Black, true); } catch (Exception) { Printer.Print($"[Manabars]: {v.StoredName()}"); } } }
private static void DrawTarget() { heroIcon = Drawing.GetTexture("materials/ensage_ui/miniheroes/tinker"); iconSize = new Vector2(HUDInfo.GetHpBarSizeY() * 2); if ( !Drawing.WorldToScreen(target.Position + new Vector3(0, 0, target.HealthBarOffset / 3), out screenPosition)) { return; } screenPosition += new Vector2(-iconSize.X, 0); Drawing.DrawRect(screenPosition, iconSize, heroIcon); if (circle == null) { circle = new ParticleEffect(@"particles\ui_mouseactions\range_finder_tower_aoe.vpcf", target); circle.SetControlPoint(2, me.Position); circle.SetControlPoint(6, new Vector3(1, 0, 0)); circle.SetControlPoint(7, target.Position); } else { circle.SetControlPoint(2, me.Position); circle.SetControlPoint(6, new Vector3(1, 0, 0)); circle.SetControlPoint(7, target.Position); } }
public KillableCreep(Unit unit) : base(unit) { HpBarSize = new Vector2(HUDInfo.GetHPBarSizeX(Unit) - 26, HUDInfo.GetHpBarSizeY(Unit) / 2); DefaultTextureY = -50; UnitType = UnitType.Creep; }
private static void DrawOldMethod(Hero v, List <Item> items) { float count = 0; var iPos = HUDInfo.GetHPbarPosition(v); var iSize = new Vector2(HUDInfo.GetHPBarSizeX(v), HUDInfo.GetHpBarSizeY(v)); foreach (var item in items) { var itemname = Textures.GetItemTexture(item.StoredName()); Drawing.DrawRect(iPos + new Vector2(count, 50), new Vector2(iSize.X / 3, (float)(iSize.Y * 2.5)), itemname); if (item.AbilityState == AbilityState.OnCooldown) { var cd = ((int)item.Cooldown).ToString(CultureInfo.InvariantCulture); Drawing.DrawText(cd, iPos + new Vector2(count, 40), Color.White, FontFlags.AntiAlias | FontFlags.DropShadow); } if (item.AbilityState == AbilityState.NotEnoughMana) { Drawing.DrawRect(iPos + new Vector2(count, 50), new Vector2(iSize.X / 4, (float)(iSize.Y * 2.5)), new Color(0, 0, 200, 100)); } count += iSize.X / 4; } }
private void Drawing_OnDraw(EventArgs args) { if (!Config.Enabled) { return; } var enemies = EntityManager <Hero> .Entities .Where(x => myHero.Team != x.Team && x.IsValid && !x.IsIllusion && x.IsAlive && x.IsVisible) .ToList(); if (!enemies.Any()) { return; } var threshold = OrbwalkerMode.R.GetAbilityData("kill_threshold"); if (threshold <= 0) { return; } foreach (var enemy in enemies) { var tmp = enemy.Health < threshold ? enemy.Health : threshold; var perc = tmp / enemy.MaximumHealth; var pos = HUDInfo.GetHPbarPosition(enemy) + 2; var size = new Vector2(HUDInfo.GetHPBarSizeX(enemy) - 6, HUDInfo.GetHpBarSizeY(enemy) - 2); Drawing.DrawRect(pos, new Vector2(size.X * perc, size.Y), Color.Chocolate); } }
public KillableTower(Unit unit) : base(unit) { hpBarPositionFix = new Vector2(-2, -31); HpBarSize = new Vector2(HUDInfo.GetHPBarSizeX(Unit) + 5, HUDInfo.GetHpBarSizeY(Unit) / 2); DefaultTextureY = -50; UnitType = UnitType.Tower; }
public KillableCreep(Unit unit) : base(unit) { hpBarPositionFix = new Vector2(13, 21); HpBarSize = new Vector2(HUDInfo.GetHPBarSizeX(Unit) - 24, HUDInfo.GetHpBarSizeY(Unit) / 2); DefaultTextureY = -50; UnitType = UnitType.Creep; }
private static void DrawEzKill() { if (!Menu.Item("ezKillCheck").GetValue <bool>() || Game.IsWatchingGame || Game.IsChatOpen) { return; } switch (ezKillStyle.GetValue <StringList>().SelectedIndex) { case 0: var icoSize = new Vector2((float)(HUDInfo.GetHpBarSizeY() * 2)); var icoPos = HUDInfo.GetHPbarPosition(target) - new Vector2(21, 5); switch (IsEzKillable()) { case true: ezkillIcon = Drawing.GetTexture("materials/ensage_ui/emoticons/bc_emoticon_fire"); break; case false: ezkillIcon = null; break; } Drawing.DrawRect(icoPos, icoSize, ezkillIcon); break; case 1: var pos = HUDInfo.GetHPbarPosition(target); var size = HUDInfo.GetHpBarSizeY() + 3; var text = string.Empty; var color = new Color(); var fontFlags = FontFlags.AntiAlias | FontFlags.Additive; if (Game.IsKeyDown(comboKey.GetValue <KeyBind>().Key)) { pos = pos - new Vector2(58, 0); text = "CASTING..."; color = Color.Crimson; } else { switch (IsEzKillable()) { case true: pos = pos - new Vector2(40, 0); text = "EZKILL"; color = Color.Chartreuse; break; case false: pos = pos - new Vector2(63, 0); text = "NON-EZKILL"; color = Color.White; break; } } Drawing.DrawText(text, pos, new Vector2(size), color, fontFlags); break; } }
public AutoSunStrike(Config config) { _config = config; var main = _config.Factory.Menu("Auto SunStrike"); Enable = main.Item("Enable", true); KillStealOnly = main.Item("Kill Steal Only", true); UseOnlyOnStunnedEnemies = main.Item("Only on stunned enemies", true); DrawPrediction = main.Item("Draw prediction", true); DrawPredictionKillSteal = main.Item("Draw prediction only when target will die after ss", true); InvokeSunStike = main.Item("Invoke sun strike", true); Notification = main.Item("Notification if target is Killable", true); SsTiming = main.Item("Timing for auto SunStrike (in ms)", new Slider(2000, 100, 3500)); DrawDamage = main.Item("Draw damage from SunStrike", true); MoveCamera = main.Item("Move camera", true); //DrawDamageType = main.Item("Type of drawing", new StringList("Only text","Icon + text")); _damageDict = new Dictionary <uint, int>(); if (Enable) { Activate(); } if (DrawDamage) { Drawing.OnDraw += OnDraw; } DrawDamage.PropertyChanged += (sender, args) => { if (DrawDamage) { Drawing.OnDraw += OnDraw; } else { Drawing.OnDraw -= OnDraw; } }; Enable.PropertyChanged += (sender, args) => { if (Enable) { Activate(); } else { Deactivate(); } }; HpBarSize = new Vector2(HUDInfo.GetHpBarSizeY() * 2.5f); HpBarY = HUDInfo.GetHpBarSizeY(); }
private static void DrawDangeItems() { foreach (var hero in Manager.HeroManager.GetEnemyViableHeroes()) { try { if (Manager.HeroManager.GetItemList(hero) == null) { continue; } var iPos = HUDInfo.GetHPbarPosition(hero); var iSize = new Vector2(HUDInfo.GetHPBarSizeX(hero), HUDInfo.GetHpBarSizeY(hero)); float count = 0; List <Item> items; try { if (!Members.ItemDictionary.TryGetValue(hero.Name, out items)) { continue; } } catch (Exception) { Printer.Print("[DrawDangeItems]: " + hero.StoredName()); continue; } foreach ( var item in items .Where(x => x != null && x.IsValid && Members.Menu.Item("dangitems.List").GetValue <AbilityToggler>().IsEnabled(x.Name)) ) { var itemname = $"materials/ensage_ui/items/{item.Name.Replace("item_", "")}.vmat"; Drawing.DrawRect(iPos + new Vector2(count, 50), new Vector2(iSize.X / 3, (float)(iSize.Y * 2.5)), Textures.GetTexture(itemname)); if (item.AbilityState == AbilityState.OnCooldown) { var cd = ((int)item.Cooldown).ToString(CultureInfo.InvariantCulture); Drawing.DrawText(cd, iPos + new Vector2(count, 40), Color.White, FontFlags.AntiAlias | FontFlags.DropShadow); } if (item.AbilityState == AbilityState.NotEnoughMana) { Drawing.DrawRect(iPos + new Vector2(count, 50), new Vector2(iSize.X / 4, (float)(iSize.Y * 2.5)), new Color(0, 0, 200, 100)); } count += iSize.X / 4; } } catch (Exception e) { Printer.Print($"[DrawDangeItems]: all --> {e.StackTrace}"); } } }
private static void Overlay1(EventArgs args) { if (!Game.IsInGame) { return; } if (Menu.Item("manabar").GetValue <bool>()) { var player = ObjectMgr.LocalPlayer; if (player == null || player.Team == Team.Observer) { return; } var enemies = ObjectMgr.GetEntities <Hero>() .Where(x => x.IsVisible && x.IsAlive && x.MaximumMana > 0 && !x.IsIllusion && x.Team != player.Team) .ToList(); foreach (var enemy in enemies) { var start = HUDInfo.GetHPbarPosition(enemy) + new Vector2(0, HUDInfo.GetHpBarSizeY(enemy) + 1); var manaperc = enemy.Mana / enemy.MaximumMana; var size = new Vector2(HUDInfo.GetHPBarSizeX(enemy), HUDInfo.GetHpBarSizeY(enemy) * 2 / 5); Drawing.DrawRect(start, size + new Vector2(1, 1), Color.Black); Drawing.DrawRect(start, new Vector2(size.X * manaperc, size.Y), new Color(100, 135, 240, 255)); Drawing.DrawRect(start + new Vector2(-1, -2), size + new Vector2(4, 3), Color.Black, true); } } if (Menu.Item("toppanel").GetValue <bool>()) { for (uint i = 0; i < 10; i++) { var v = ObjectMgr.GetPlayerById(i).Hero; if (v == null || !v.IsAlive) { continue; } var pos = HUDInfo.GetTopPanelPosition(v); var sizeX = (float)HUDInfo.GetTopPanelSizeX(v); var sizeY = (float)HUDInfo.GetTopPanelSizeY(v); var healthDelta = new Vector2(v.Health * sizeX / v.MaximumHealth, 0); var manaDelta = new Vector2(v.Mana * sizeX / v.MaximumMana, 0); const int height = 7; Drawing.DrawRect(pos + new Vector2(0, sizeY + 1), new Vector2(healthDelta.X, height), new Color(0, 255, 0, 100)); Drawing.DrawRect(pos + new Vector2(0, sizeY + 1), new Vector2(sizeX, height), Color.Black, true); Drawing.DrawRect(pos + new Vector2(0, sizeY + height), new Vector2(manaDelta.X, height), new Color(80, 120, 255, 255)); Drawing.DrawRect(pos + new Vector2(0, sizeY + height), new Vector2(sizeX, height), Color.Black, true); } } }
/// <summary>Initializes a new instance of the <see cref="UnitIconDrawerMenu" /> class.</summary> internal UnitIconDrawerMenu() { this.Menu = new Menu("IconDrawer", Constants.AssemblyName + "UnitIconDrawer"); var reso = "(" + HUDInfo.ScreenSizeX() + "x" + HUDInfo.ScreenSizeY() + ")"; this.sizeMenuItem = this.Menu.AddItem( new MenuItem( this.Menu.Name + nameof(this.sizeMenuItem) + HUDInfo.ScreenSizeY() + HUDInfo.ScreenSizeX(), "Minimap icon size " + reso).SetValue( new Slider((int)(HUDInfo.GetHpBarSizeY() * 1.5), (int)(HUDInfo.GetHpBarSizeY() * 1.5), 64)) .SetTooltip("Set minimap icon size for resolution " + reso)); }
/// <summary> /// Initializes a new instance of the <see cref="ChargeOfDarkness" /> class. /// </summary> /// <param name="ability"> /// The ability. /// </param> public ChargeOfDarkness(Ability ability) { this.ability = ability; this.speed = ability.GetProjectileSpeed(); this.sleeper = new Sleeper(); this.lastLevel = ability.Level; this.abilityIcon = Drawing.GetTexture("materials/ensage_ui/spellicons/spirit_breaker_charge_of_darkness"); this.iconSize = new Vector2(HUDInfo.GetHpBarSizeY() * 2); this.CastPoint = this.ability.FindCastPoint(); this.notification = new Notification( 5000, new Vector2(HUDInfo.ScreenSizeX(), (float)(HUDInfo.ScreenSizeY() / 2.3)), new Vector2(HUDInfo.ScreenSizeX() / 11, HUDInfo.ScreenSizeX() / 30)); }
private static void Drawing_OnDraw(EventArgs args) { if (!Checker.IsActive()) { return; } if (!IsEnable) { return; } foreach (var v in Manager.HeroManager.GetEnemyViableHeroes()) { try { var pos = HUDInfo.GetHPbarPosition(v); if (pos.IsZero) { continue; } pos += new Vector2(0, HUDInfo.GetHpBarSizeY() - 2); var size = new Vector2(HUDInfo.GetHPBarSizeX(), HUDInfo.GetHpBarSizeY() * ManaBarSize); var manaDelta = new Vector2(v.Mana * size.X / v.MaximumMana, 0); Drawing.DrawRect(pos, size, Color.Black); Drawing.DrawRect(pos, new Vector2(manaDelta.X, size.Y), new Color(R, G, B, 255)); Drawing.DrawRect(pos, size, Color.Black, true); if (IsNumsEnable) { var text = $"{(int)v.Mana}/{(int)v.MaximumMana}"; var textSize = Drawing.MeasureText(text, "Arial", new Vector2((float)(size.Y * DigSize), size.Y / 2), FontFlags.AntiAlias); var textPos = pos + new Vector2(size.X / 2 - textSize.X / 2, size.Y - textSize.Y); /*Drawing.DrawRect(textPos - new Vector2(0, 0), * new Vector2(textSize.X, textSize.Y), * new Color(0, 0, 0, 200));*/ Drawing.DrawText( text, textPos, new Vector2(textSize.Y, 0), Color.White, FontFlags.AntiAlias | FontFlags.StrikeOut); } } catch (Exception) { Printer.Print($"[Manabars]: {v.StoredName()}"); } } }
private static void Drawing_OnDraw(EventArgs args) { if (!Checker.IsActive()) { return; } if (!IsEnable) { return; } if (InSys == null || InSys.Count == 0) { return; } var haveEb = InSys.Any(x => x.StoredName() == "item_ethereal_blade" && x.CanBeCasted()); foreach (var v in Manager.HeroManager.GetEnemyViableHeroes()) { try { var pos = HUDInfo.GetHPbarPosition(v); if (pos.IsZero) { continue; } var myDmg = InSys.Where(x => x.CanBeCasted()) .Sum( x => AbilityDamage.CalculateDamage(x, Members.MyHero, v, minusMagicResistancePerc: haveEb ? 40 : 0)); var healthAfterShit = (int)(v.Health - myDmg); var size = HUDInfo.GetHpBarSizeY(); var text = $"{healthAfterShit} ({myDmg})"; var textSize = Drawing.MeasureText(text, "Arial", new Vector2((float)(size * 1.5), 500), FontFlags.AntiAlias); var textPos = pos + new Vector2(HUDInfo.GetHPBarSizeX() + 4, 0); Drawing.DrawText( text, textPos, new Vector2(textSize.Y, 0), new Color(R, G, B, 255), FontFlags.AntiAlias | FontFlags.StrikeOut); } catch (Exception) { Printer.Print($"[DamageCalculation]: {v.StoredName()}"); } } }
public Window(Vector2 size, Vector2 position, string name, Body body) { this.Size = size; this.Position = position; this.body = body; this.topPanel = new TopPanel( new Vector2(size.X, (float)(HUDInfo.GetHpBarSizeY() * 2.5)), position - new Vector2(0, HUDInfo.GetHpBarSizeY() * 3), name); this.body.Position = this.topPanel.Position + new Vector2(0, this.topPanel.Size.Y); this.closeButton = new Button( new Vector2((float)(this.topPanel.Size.Y * 1.2), this.topPanel.Size.Y), new Vector2((float)(this.topPanel.Size.X - this.topPanel.Size.Y * 1.2), 0), "x", Color.White, this.topPanel, () => { this.topPanel.Visible = false; this.body.Visible = false; this.closeButton.Visible = false; this.hideButton.Visible = false; }); this.elements.Add(this.closeButton); this.hideButton = new Button( this.closeButton.Size, new Vector2(this.topPanel.Size.X - this.closeButton.Size.X * 2 - 1, 0), "-", Color.White, this.topPanel, () => { this.body.Visible = !this.body.Visible; this.hideButton.Text = !this.body.Visible ? "+" : "-"; }); this.elements.Add(this.hideButton); this.topPanel.PositionUpdate.Subscribe( new DataObserver <Vector2>( vector2 => { this.body.Position = vector2 + new Vector2(0, this.topPanel.Size.Y); foreach (var userInterfaceElement in this.elements) { userInterfaceElement.UpdatePosition(); } })); }
private void showHpBar() { Damage[] damageList = new Damage[_satellite.DamageList.Count]; _satellite.DamageList.CopyTo(damageList); foreach (var data in damageList) { var target = data.GetTarget; var hpBarPosition = HUDInfo.GetHPbarPosition(target); if (!hpBarPosition.IsZero) { var hpBarSizeX = HUDInfo.GetHPBarSizeX(target); var hpBarSizeY = HUDInfo.GetHpBarSizeY(target); var myHudSizeY = HUDInfo.GetHpBarSizeY(target) * 0.5f; var hpBarPos = hpBarPosition + new Vector2(1, hpBarSizeY * 0.5f); var health = data.GetHealth; var readyDamage = data.GetReadyDamage; var readyDamageBar = Math.Max(readyDamage, 0) / target.MaximumHealth; if (readyDamageBar > 0) { //剩余和最大生命值的比例 var readyDamagePos = Math.Max(health - readyDamage, 0) / target.MaximumHealth; //计算剩余血量终点的位置,刚好是预计伤害的起点 var readyDamagePosition = new Vector2(hpBarPos.X + hpBarSizeX * readyDamagePos, hpBarPos.Y); //计算预计伤害的长度hpBarSizeX*readyDamageBar,防止溢出,要减去溢出的伤害血量 //这是一种取巧的写法,普通应该是判断溢出直接等同于当前血量的终点 var readyDamageSize = new Vector2(hpBarSizeX * (readyDamageBar + Math.Min(health - readyDamage, 0) / target.MaximumHealth), myHudSizeY); var readyDamageColor = (readyDamage - health) < 0 ? Color.FromArgb(200, 100, 0, 0) : Color.FromArgb(200, 191, 255, 0); var rect = new RectangleF(readyDamagePosition.X, readyDamagePosition.Y, readyDamageSize.X, readyDamageSize.Y); renderer.DrawFilledRectangle(rect, Color.Black, readyDamageColor, 1f); } var damage = data.GetDamage; var damageBar = Math.Max(damage, 0) / target.MaximumHealth; if (damageBar > 0) { var damagePos = Math.Max(health - damage, 0) / target.MaximumHealth; var damagePosition = new Vector2(hpBarPos.X + (hpBarSizeX * damagePos), hpBarPos.Y); var damageSize = new Vector2(hpBarSizeX * (damageBar + Math.Min(health - damage, 0) / target.MaximumHealth), myHudSizeY); var damageColor = (damage - health) < 0? Color.FromArgb(255, 0, 255, 0) : Color.Aqua; var rect = new RectangleF(damagePosition.X, damagePosition.Y, damageSize.X, damageSize.Y); renderer.DrawFilledRectangle(rect, Color.Black, damageColor, 1f); } } } }
public TeamEntry(IAbilityTeam team, IUserInterfaceElement parent) { this.Team = team; this.Parent = parent; this.teamNameBg.Size = new Vector2(parent.Size.X, HUDInfo.GetHpBarSizeY() * 2); this.teamName.Text = team.Name.ToString(); this.teamName.TextSize = new Vector2(this.teamNameBg.Size.Y); this.hideButton = new Button( new Vector2(this.teamNameBg.Size.Y), new Vector2(this.teamNameBg.Size.X - this.teamNameBg.Size.Y, 0), "-", Color.White, this, () => { this.drawElements = !this.drawElements; if (this.drawElements) { this.hideButton.Text = "-"; } else { this.hideButton.Text = "+"; } this.UpdateSize(); }); // foreach (var abilityUnit in this.Team.UnitManager.Units) // { // this.unitEntries.Add(abilityUnit.Key, new UnitEntry(abilityUnit.Value, this)); // } this.Team.UnitManager.UnitAdded.Subscribe( new DataObserver <IAbilityUnit>( unit => { this.unitEntries.Add(unit.UnitHandle, new UnitOverlayEntry(unit, this)); this.UpdateSize(); })); this.Team.UnitManager.UnitRemoved.Subscribe( new DataObserver <IAbilityUnit>( unit => { this.unitEntries.Remove(unit.UnitHandle); this.UpdateSize(); })); this.UpdateSize(); }
private static void Drawing_OnDraw(EventArgs args) { if (!Game.IsInGame) { return; } var player = ObjectManager.LocalPlayer; if (player == null || player.Team == Team.Observer) { return; } var enemies = ObjectManager.GetEntities <Hero>() .Where(x => x.IsVisible && x.IsAlive && x.MaximumMana > 0 && !x.IsIllusion && x.Team != player.Team) .ToList(); foreach (var enemy in enemies) { var start = HUDInfo.GetHPbarPosition(enemy); if (start == Vector2.Zero) { continue; } start = start + new Vector2(0, HUDInfo.GetHpBarSizeY(enemy) + 1); var manaperc = enemy.Mana / enemy.MaximumMana; var size = new Vector2(HUDInfo.GetHPBarSizeX(enemy), HUDInfo.GetHpBarSizeY(enemy) / 2); // Draw background Drawing.DrawRect(start, size + new Vector2(1, 1), new Color(0, 0, 50, 150)); // Draw manabar Drawing.DrawRect(start, new Vector2(size.X * manaperc, size.Y), Color.RoyalBlue); // Draw frame Drawing.DrawRect(start + new Vector2(-1, -1), size + new Vector2(3, 3), Color.Black, true); // Draw text var text = string.Format("{0} / {1}", (int)enemy.Mana, (int)enemy.MaximumMana); var textSize = Drawing.MeasureText(text, "Arial", new Vector2(size.Y * 2, size.X), FontFlags.AntiAlias); var textPos = start + new Vector2(size.X / 2 - textSize.X / 2, -textSize.Y / 2 + 2); Drawing.DrawText( text, textPos, new Vector2(size.Y * 2, size.X), Color.White, FontFlags.AntiAlias | FontFlags.DropShadow); } }
private void OnDraw(EventArgs args) { foreach (var data in Config.DamageCalculation.DamageList) { var target = data.GetTarget; var health = data.GetHealth; var damage = data.GetDamage; var readyDamage = data.GetReadyDamage; if (Menu.HPBarCalculationItem) { var hpBarPosition = HUDInfo.GetHPbarPosition(target); if (!hpBarPosition.IsZero) { var hpBarSizeX = HUDInfo.GetHPBarSizeX(target); var hpBarSizeY = HUDInfo.GetHpBarSizeY(target) / 1.7f; var hpBarPos = hpBarPosition + new Vector2(0, hpBarSizeY * (Menu.HPBarCalculationPosItem / 70f)); var readyDamageBar = Math.Max(readyDamage, 0) / target.MaximumHealth; if (readyDamageBar > 0) { var readyDamagePos = Math.Max(health - readyDamage, 0) / target.MaximumHealth; var readyDamagePosition = new Vector2(hpBarPos.X + ((hpBarSizeX + readyDamageBar) * readyDamagePos), hpBarPos.Y); var readyDamageSize = new Vector2(hpBarSizeX * (readyDamageBar + Math.Min(health - readyDamage, 0) / target.MaximumHealth), hpBarSizeY); var readyDamageColor = ((float)health / target.MaximumHealth) - readyDamageBar > 0 ? new Color(100, 0, 0, 200) : new Color(191, 255, 0, 200); Drawing.DrawRect(readyDamagePosition, readyDamageSize, readyDamageColor); Drawing.DrawRect(readyDamagePosition, readyDamageSize, Color.Black, true); } var damageBar = Math.Max(damage, 0) / target.MaximumHealth; if (damageBar > 0) { var damagePos = Math.Max(health - damage, 0) / target.MaximumHealth; var damagePosition = new Vector2(hpBarPos.X + ((hpBarSizeX + damageBar) * damagePos), hpBarPos.Y); var damageSize = new Vector2(hpBarSizeX * (damageBar + Math.Min(health - damage, 0) / target.MaximumHealth), hpBarSizeY); var damageColor = ((float)health / target.MaximumHealth) - damageBar > 0 ? new Color(0, 255, 0) : Color.Aqua; Drawing.DrawRect(damagePosition, damageSize, damageColor); Drawing.DrawRect(damagePosition, damageSize, Color.Black, true); } } } } }
public ScreenInfo(IAbilityUnit unit) { this.Unit = unit; var hero = unit.SourceUnit as Hero; if (hero != null) { this.TopPanelPosition = HUDInfo.GetTopPanelPosition(hero); this.TopPanelIconSize = new Vector2( (float)HUDInfo.GetTopPanelSizeX(hero), (float)HUDInfo.GetTopPanelSizeY(hero)); } this.HealthBarSize = new Vector2( HUDInfo.GetHPBarSizeX(hero ?? unit.SourceUnit), HUDInfo.GetHpBarSizeY(hero ?? unit.SourceUnit)); }
private static void drawHPLastHit() { var enemies = ObjectManager.GetEntities <Unit>().Where(x => (x.ClassID == ClassID.CDOTA_BaseNPC_Tower || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane || x.ClassID == ClassID.CDOTA_BaseNPC_Creep || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Neutral || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege || x.ClassID == ClassID.CDOTA_BaseNPC_Additive || x.ClassID == ClassID.CDOTA_BaseNPC_Building || x.ClassID == ClassID.CDOTA_BaseNPC_Creature) && x.IsAlive && x.IsVisible && x.Team != me.Team && x.Distance2D(me) < attackRange + 600); foreach (var enemy in enemies.Where(x => true)) { var health = enemy.Health; var maxHealth = enemy.MaximumHealth; if (health == maxHealth) { continue; } var damge = (float)getDmgOnUnit(enemy, 0); var hpleft = health; var hpperc = hpleft / maxHealth; var hbarpos = HUDInfo.GetHPbarPosition(enemy); Vector2 screenPos; var enemyPos = enemy.Position + new Vector3(0, 0, enemy.HealthBarOffset); if (!Drawing.WorldToScreen(enemyPos, out screenPos)) { continue; } var start = screenPos; hbarpos.X = start.X - HUDInfo.GetHPBarSizeX(enemy) / 2; hbarpos.Y = start.Y; var hpvarx = hbarpos.X; var a = (float)Math.Round(damge * HUDInfo.GetHPBarSizeX(enemy) / enemy.MaximumHealth); var position = hbarpos + new Vector2(hpvarx * hpperc + 10, -12); try { Drawing.DrawRect(position, new Vector2(a, HUDInfo.GetHpBarSizeY(enemy) - 4), enemy.Health > damge ? enemy.Health > damge * 2 ? new Color(180, 205, 205, 40) : new Color(255, 0, 0, 60) : new Color(127, 255, 0, 80)); Drawing.DrawRect(position, new Vector2(a, HUDInfo.GetHpBarSizeY(enemy) - 4), Color.Black, true); } catch (Exception e) { Console.WriteLine(e.Message); } } }
public static void Drawing_OnDraw(EventArgs args) { if (!IsEnable) { return; } if (_globalTarget != null && _globalTarget.IsValid) { Helper.HandleEffect(_globalTarget); } var closeToMouse = Helper.ClosestToMouse(Members.MyHero); if (DamageIndex == (int)DamageDrawing.OnlyForGlobalTarget && (closeToMouse == null || !closeToMouse.IsValid)) { return; } var list = DamageIndex == (int)DamageDrawing.ForAll ? Heroes.GetByTeam(Members.MyHero.GetEnemyTeam()) .Where(x => x.IsAlive && x.IsVisible && !x.IsIllusion() && !x.IsMagicImmune()).ToList() : new List <Hero> { closeToMouse }; foreach (var hero in list) { var pos = HUDInfo.GetHPbarPosition(hero); if (pos.IsZero) { continue; } var size = HUDInfo.GetHpBarSizeY(); var text = $" {(int) Helper.CalculateMyCurrentDamage(hero)} ({(int) Helper.CalculateMyDamage(hero)})"; var textSize = Drawing.MeasureText(text, "Arial", new Vector2((float)(size * 1.5), 500), FontFlags.AntiAlias); var textPos = pos + new Vector2(HUDInfo.GetHPBarSizeX() + 4, 0); Drawing.DrawText( text, textPos, new Vector2(textSize.Y, 0), new Color(255, 255, 255, 255), FontFlags.AntiAlias | FontFlags.StrikeOut); } }
private static void OnDraw(EventArgs args) { if (_globalTarget == null || !_globalTarget.IsValid || !_globalTarget.IsAlive) { return; } var start = HUDInfo.GetHPbarPosition(_globalTarget) + new Vector2(-HUDInfo.GetHPBarSizeX(_globalTarget) / 2, -HUDInfo.GetHpBarSizeY(_globalTarget) * 5); var size = new Vector2(HUDInfo.GetHPBarSizeX(_globalTarget), HUDInfo.GetHpBarSizeY(_globalTarget) / 2) * 2; const string text = "TARGET"; var textSize = Drawing.MeasureText(text, "Arial", new Vector2(size.Y * 2, size.X), FontFlags.AntiAlias); var textPos = start + new Vector2(size.X / 2 - textSize.X / 2, -textSize.Y / 2 + 2); Drawing.DrawText( text, textPos, new Vector2(size.Y * 2, size.X), Color.White, FontFlags.AntiAlias | FontFlags.DropShadow | FontFlags.Additive); }
private void DrawUltDamage(IEnumerable <Hero> enemyHeroes) { if (drawSettingsMenu.DrawUltDamageItem) { var walrusPunch = abilities.WalrusPunch; if (!walrusPunch.IsReady && walrusPunch.Ability.Level < 1) { return; } foreach (var enemy in enemyHeroes) { var healthPosition = HUDInfo.GetHPbarPosition(enemy); // If the enemy is visible but out of screen the health position x and y will always be zero and in that case i don't want to draw anything for that hero. if (healthPosition.IsZero) { continue; } healthPosition.X += 2; healthPosition.Y += 2; var healthSize = new Vector2(HUDInfo.GetHPBarSizeX(enemy), HUDInfo.GetHpBarSizeY(enemy)); var damage = walrusPunch.GetDamage(enemy); var damagePercent = enemy.MaximumHealth / damage; var damageSize = new Vector2(healthSize.X / damagePercent, healthSize.Y); var color = enemy.Health < damage ? Color.DarkOrange : Color.DarkRed; if (enemy.Health < damage) { float enemyHealthPercent = (float)enemy.MaximumHealth / enemy.Health; damageSize = new Vector2(healthSize.X / enemyHealthPercent, healthSize.Y); } Drawing.DrawRect(healthPosition, damageSize, color); } } }
private static void DrawOnHeroes(BombDamageManager.HeroDamageContainer heroCont) { var hero = heroCont.Hero; if (!hero.IsVisible || !hero.IsAlive) { return; } var topPos = HUDInfo.GetHPbarPosition(hero); var size = new Vector2((float)HUDInfo.GetHPBarSizeX(hero), (float)HUDInfo.GetHpBarSizeY(hero)); var text = heroCont.HealthAfterSuicide.ToString("####"); var textSize = Drawing.MeasureText(text, "Arial", new Vector2((float)(size.Y * 1.5), (float)(size.Y * 1.5)), FontFlags.AntiAlias); var textPos = topPos - new Vector2(textSize.X + 5, 0); Drawing.DrawText( text, textPos + new Vector2(2, 2), new Vector2(textSize.Y, 0), Color.White, FontFlags.AntiAlias | FontFlags.StrikeOut); }