コード例 #1
0
 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()}");
         }
     }
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: maza51/Ensage
        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);
            }
        }
コード例 #3
0
 public static void damagecalc(EventArgs args)
 {
     if (!Game.IsInGame || Game.IsWatchingGame)
     {
         return;
     }
     me = ObjectMgr.LocalHero;
     if (me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Necrolyte)
     {
         return;
     }
     if (Menu.Item("Drawing.Info").GetValue <bool>())
     {
         if (Utils.SleepCheck("locktarget"))
         {
             target = me.ClosestToMouseTarget(1000);
         }
         if (target == null)
         {
             return;
         }
         if (target != null)
         {
             var combodamage     = ComboDamage();
             var BarSize_Requiem = (HUDInfo.GetHPBarSizeX(target) / ((float)(target.MaximumHealth - combodamage) / (target.Health - combodamage)));
             if (BarSize_Requiem > HUDInfo.GetHPBarSizeX(target))
             {
                 BarSize_Requiem = HUDInfo.GetHPBarSizeX(target);
             }
             Drawing.DrawText((target.Health - combodamage) > 0 ? "" + (int)(target.Health - combodamage) : "Killable", new Vector2(HUDInfo.GetHPbarPosition(target).X, HUDInfo.GetHPbarPosition(target).Y - 42), new Vector2(15, 20), combodamage < target.Health ? Color.White : Color.Red, FontFlags.Additive);
             Drawing.DrawRect(new Vector2(HUDInfo.GetHPbarPosition(target).X, HUDInfo.GetHPbarPosition(target).Y - 1), new Vector2(combodamage >= target.MaximumHealth ? 0 : BarSize_Requiem, HUDInfo.GetHpBarSizeY(target) - 8), Color.GreenYellow);
             Drawing.DrawRect(new Vector2(HUDInfo.GetHPbarPosition(target).X, HUDInfo.GetHPbarPosition(target).Y - 1), new Vector2(HUDInfo.GetHPBarSizeX(target), HUDInfo.GetHpBarSizeY(target) - 8), Color.Black, true);
         }
     }
 }
コード例 #4
0
 public KillableCreep(Unit unit)
     : base(unit)
 {
     HpBarSize       = new Vector2(HUDInfo.GetHPBarSizeX(Unit) - 26, HUDInfo.GetHpBarSizeY(Unit) / 2);
     DefaultTextureY = -50;
     UnitType        = UnitType.Creep;
 }
コード例 #5
0
        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;
            }
        }
コード例 #6
0
ファイル: KillableCourier.cs プロジェクト: XXXHake/Ensage-1
 public KillableCourier(Unit unit)
     : base(unit)
 {
     HpBarSize       = new Vector2(HUDInfo.GetHPBarSizeX(Unit) - 12, HUDInfo.GetHpBarSizeY(Unit) / 2);
     DefaultTextureY = -50;
     UnitType        = UnitType.Courier;
 }
コード例 #7
0
ファイル: BombStatus.cs プロジェクト: xqkadpa/EnsageSharp
        public static void OnDraw(EventArgs args)
        {
            if (!Enable || !MenuManager.IsEnable)
            {
                return;
            }
            foreach (
                var bomb in
                Core.Bombs.Where(x => x.Active && !x.IsRemoteMine && x.Status == Enums.BombStatus.WillDetonate))
            {
                var pos       = HUDInfo.GetHPbarPosition(bomb.Bomb);//Drawing.WorldToScreen(bomb.Bomb.Position);
                var bombTimer = Game.RawGameTime - bomb.StatusStartTIme;
                var hpBarSize = HUDInfo.GetHPBarSizeX();
                var size      = new Vector2(hpBarSize * 1f, BarSize);
                var cdDelta   = bombTimer * size.X / BombMaxTimer;
                pos += new Vector2(0, hpBarSize * 0.5f);
                Drawing.DrawRect(pos, new Vector2(size.X, size.Y), Color.Black);
                Drawing.DrawRect(pos, new Vector2(size.X - cdDelta, size.Y), Color.YellowGreen);
                Drawing.DrawRect(pos, new Vector2(size.X, size.Y), Color.Black, true);

                if (DrawDigs)
                {
                    var text     = $"{(int) (100 - bombTimer/BombMaxTimer*100)}%";
                    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.DrawText(
                        text,
                        textPos,
                        new Vector2(textSize.Y, 0),
                        Color.White,
                        FontFlags.AntiAlias | FontFlags.StrikeOut);
                }
            }
        }
コード例 #8
0
ファイル: KillableCreep.cs プロジェクト: ihatevim/Ensage-2
 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;
 }
コード例 #9
0
 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;
 }
コード例 #10
0
        private void DrawingOnOnDraw(EventArgs args)
        {
            if (Enable)
            {
                foreach (var shrine in Shrines)
                {
                    if (shrine.Unit == null || !shrine.Unit.IsValid)
                    {
                        continue;
                    }
                    var v   = shrine.Unit;
                    var pos = HUDInfo.GetHPbarPosition(v);
                    if (pos.IsZero)
                    {
                        continue;
                    }
                    var filler = GetFiller(shrine);
                    if (filler == null || filler.AbilityState == AbilityState.Ready)
                    {
                        continue;
                    }
                    var cd        = filler.Cooldown;
                    var cdLength  = filler.CooldownLength;
                    var hpBarSize = HUDInfo.GetHPBarSizeX();
                    var size      = new Vector2(hpBarSize * 2, 15);
                    var buff      = v.FindModifier("modifier_filler_heal_aura");
                    var isBuff    = buff != null;
                    var remTine   = buff?.RemainingTime;
                    var cdDelta   = isBuff ? buff.RemainingTime * size.X / 5 : cd * size.X / cdLength;
                    pos += new Vector2(-hpBarSize / 2, hpBarSize * 1.5f);
                    if (true)
                    {
                        Drawing.DrawRect(pos, new Vector2(size.X, size.Y), Color.Black);
                        Drawing.DrawRect(pos, new Vector2(isBuff ? cdDelta : size.X - cdDelta, size.Y),
                                         isBuff ? Color.Orange : Color.YellowGreen);
                        Drawing.DrawRect(pos, new Vector2(size.X, size.Y), Color.Black, true);
                    }

                    if (true)
                    {
                        var text     = isBuff ? $"{(int) (remTine / 5 * 100)}%" : $"{(int) (100 - cd / cdLength * 100)}%";
                        var textSize = Drawing.MeasureText(text, "Arial",
                                                           new Vector2(size.Y * 1, 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);
                    }
                }
            }
        }
コード例 #11
0
ファイル: ItemOverlay.cs プロジェクト: y921231/EnsageSharp
        private static void DrawItems(Hero v, bool forEnemy)
        {
            var pos = HUDInfo.GetHPbarPosition(v);

            if (pos.IsZero)
            {
                return;
            }
            List <Item> items;

            try
            {
                if (!Members.ItemDictionary.TryGetValue(v.Name, out items))
                {
                    return;
                }
            }
            catch (Exception)
            {
                Printer.Print("[ItemOverlay][DrawItems]: " + v.StoredName());
                return;
            }

            var count        = 0;
            var itemBoxSizeY = (float)(DefSize / 1.24);
            var newSize      = new Vector2(DefSize, itemBoxSizeY);
            var halfSize     = HUDInfo.GetHPBarSizeX() / 2;
            var maxSizeX     = Math.Max((float)items.Count / 2 * newSize.X + DefSize / (float)2.6, halfSize);

            pos -= new Vector2(-halfSize + maxSizeX, DefSize + DefSize / Extra);
            if (DangeItems && forEnemy)
            {
                items = items.Where(Check).ToList();
                if (DangOldMethod)
                {
                    DrawOldMethod(v, items);
                    return;
                }
            }
            foreach (var item in items)
            {
                try
                {
                    var tex        = Textures.GetItemTexture(item.StoredName());
                    var extraPos   = new Vector2(DefSize * count, 0);
                    var itemPos    = pos + extraPos;
                    var normalSize = newSize + new Vector2(4, DefSize / (float)2.6 + 4);
                    var normalPos  = itemPos - new Vector2(2, 2);
                    Drawing.DrawRect(normalPos, newSize + new Vector2(4, DefSize / (float)2.6 + 4), Color.Black);
                    Drawing.DrawRect(itemPos, newSize + DefSize / (float)2.6, tex);
                    DrawState(item, normalPos, normalSize, v.Mana);
                    count++;
                }
                catch (Exception)
                {
                }
            }
        }
コード例 #12
0
 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}");
         }
     }
 }
コード例 #13
0
 private static void Drawing_OnDraw(EventArgs args)
 {
     if (!Checker.IsActive())
     {
         return;
     }
     if (!IsEnable)
     {
         return;
     }
     _defSize = HUDInfo.GetHPBarSizeX() / 6 * Size;
     if (IsAlly)
     {
         foreach (var v in Manager.HeroManager.GetAllyViableHeroes())
         {
             try
             {
                 DrawItems(v, false);
             }
             catch (Exception)
             {
                 Printer.Print($"[ItemOverlay][ally]: {v.StoredName()}");
             }
         }
     }
     if (IsEnemy)
     {
         foreach (var v in Manager.HeroManager.GetEnemyViableHeroes())
         {
             try
             {
                 DrawItems(v, true);
             }
             catch (Exception)
             {
                 Printer.Print($"[ItemOverlay][enemy]: {v.StoredName()}");
             }
         }
     }
     if (IsCour)
     {
         foreach (var cour in Manager.BaseManager.GetViableCouriersList())
         {
             try
             {
                 DrawItems(cour);
             }
             catch (Exception)
             {
                 Printer.Print($"[ItemOverlay][cour]: {cour.StoredName()}");
             }
         }
     }
 }
コード例 #14
0
        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);
                }
            }
        }
コード例 #15
0
ファイル: Manabars.cs プロジェクト: zhangdaying11/EnsageSharp
        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()}");
                }
            }
        }
コード例 #16
0
        private static void DrawItems(Unit v)
        {
            var pos = HUDInfo.GetHPbarPosition(v);

            if (pos.IsZero)
            {
                return;
            }
            List <Item> items;

            try
            {
                if (!Members.ItemDictionary.TryGetValue(v.Handle, out items))
                {
                    return;
                }
            }
            catch (Exception)
            {
                Printer.Print("[ItemOverlay][DrawItems][Courier]: " + v.StoredName());
                return;
            }

            var count        = 0;
            var itemBoxSizeY = (float)(_defSize / 1.24);
            var newSize      = new Vector2(_defSize, itemBoxSizeY);
            var halfSize     = HUDInfo.GetHPBarSizeX() / 2;
            var maxSizeX     = Math.Max((float)items.Count / 2 * newSize.X + _defSize / (float)2.6, halfSize);

            pos -= new Vector2(-halfSize + maxSizeX, _defSize + _defSize / Extra);
            foreach (var item in items)
            {
                try
                {
                    var tex        = Textures.GetItemTexture(item.StoredName());
                    var extraPos   = new Vector2(_defSize * count, 0);
                    var itemPos    = pos + extraPos;
                    var normalSize = newSize + new Vector2(4, _defSize / (float)2.6 + 4);
                    var normalPos  = itemPos - new Vector2(2, 2);
                    Drawing.DrawRect(normalPos, newSize + new Vector2(4, _defSize / (float)2.6 + 4), Color.Black);
                    Drawing.DrawRect(itemPos, newSize + _defSize / (float)2.6, tex);
                    DrawState(item, normalPos, normalSize, v.Mana);
                    count++;
                }
                catch (Exception)
                {
                    // ignored
                }
            }
        }
コード例 #17
0
        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()}");
                }
            }
        }
コード例 #18
0
        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);
                    }
                }
            }
        }
コード例 #19
0
ファイル: Program.cs プロジェクト: Lat0ur/Ensage-1
        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);
            }
        }
コード例 #20
0
ファイル: Renderer.cs プロジェクト: princeag1/EnsageSharp
        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);
                        }
                    }
                }
            }
        }
コード例 #21
0
        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));
        }
コード例 #22
0
        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);
            }
        }
コード例 #23
0
ファイル: ClinkzSharp.cs プロジェクト: mhoska/Ensage
        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);
                }
            }
        }
コード例 #24
0
        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);
        }
コード例 #25
0
        public static void OnDraw(object sender, EventArgs eventArgs)
        {
            if (Core.Logics.MainLogic.DoStack)
            {
                if (Core.Config._Menu.Drawings.DrawingsOnTop)
                {
                    var _Temp = HUDInfo.GetTopPanelPosition(Core.Config._Hero) + new Vector2(0, 60);
                    Core.Config._Renderer.DrawRectangle(new RectangleF(_Temp.X, _Temp.Y, (float)HUDInfo.GetTopPanelSizeX(Core.Config._Hero), (float)HUDInfo.GetTopPanelSizeY(Core.Config._Hero)), System.Drawing.Color.Green, 2);
                }

                if (Core.Config._Menu.Drawings.DrawingsOnHero)
                {
                    String _Text     = "Pulling...";
                    var    _Pos      = HUDInfo.GetHPbarPosition(Core.Config._Hero);
                    var    _Size     = new Vector2((float)HUDInfo.GetHPBarSizeX(Core.Config._Hero), (float)HUDInfo.GetHpBarSizeY(Core.Config._Hero));
                    var    _TextSize = Core.Config._Renderer.MessureText(_Text);
                    var    _TextPos  = _Pos - new Vector2(_TextSize.X + 10, 5);
                    Core.Config._Renderer.DrawText(_TextPos, _Text, System.Drawing.Color.White);
                }
            }
        }
コード例 #26
0
        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);
                }
            }
        }
コード例 #27
0
 public static void OnDraw(EventArgs args)
 {
     if (!MenuManager.IsStackerEnabled || !MenuManager.IsEnable)
     {
         return;
     }
     foreach (var bomb in Core.Bombs.Where(x => x.IsRemoteMine && x.Active && x.Stacker.IsActive))
     {
         var topPos   = HUDInfo.GetHPbarPosition(bomb.Bomb);
         var size     = new Vector2((float)HUDInfo.GetHPBarSizeX(bomb.Bomb), (float)HUDInfo.GetHpBarSizeY(bomb.Bomb));
         var text     = bomb.Stacker.Counter.ToString();
         var textSize = Drawing.MeasureText(text, "Arial",
                                            new Vector2((float)(size.Y * 4.5f), (float)(size.Y * 4.5f)), FontFlags.AntiAlias);
         var textPos = topPos + new Vector2(size.X / 2 - textSize.X / 2, size.Y * 2);
         Drawing.DrawText(
             text,
             textPos + new Vector2(2, 2),
             new Vector2(textSize.Y, 0),
             Color.White,
             FontFlags.AntiAlias | FontFlags.StrikeOut);
     }
 }
コード例 #28
0
        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);
        }
コード例 #29
0
ファイル: Program.cs プロジェクト: TayaneAndRosa/ESharp-1
        private static void Drawing_OnDraw(EventArgs args)
        {
            if (!Game.IsInGame)
            {
                return;
            }
            var me = ObjectMgr.LocalPlayer;

            if (me == null || me.Team == Team.Observer)
            {
                return;
            }

            var enemies = ObjectMgr.GetEntities <Hero>().Where(x => x.IsVisible && x.IsAlive && x.MaximumMana > 0 && !x.IsIllusion && x.Team != me.Team).ToList();

            foreach (var enemy in enemies)
            {
                var start = HUDInfo.GetHPbarPosition(enemy) + new Vector2(0, HUDInfo.GetHpBarSizeY(enemy) + 1);
                var mprc  = enemy.Mana / enemy.MaximumMana;
                var size  = new Vector2(HUDInfo.GetHPBarSizeX(enemy), HUDInfo.GetHpBarSizeY(enemy) / 2);
                Drawing.DrawRect(start, size + new Vector2(1, 1), new Color(0, 0, 50, 150));
                Drawing.DrawRect(start, new Vector2(size.X * mprc, size.Y), Color.RoyalBlue);
                Drawing.DrawRect(start + new Vector2(-1, -1), size + new Vector2(3, 3), Color.Black, true);
                var text         = string.Format("{0}", (int)enemy.Mana);
                var text2        = string.Format("{0}", (int)enemy.Health);
                var textPos      = start + new Vector2(40, 9);
                var textPosShad  = start + new Vector2(41, 9);
                var textPos2     = start + new Vector2(40, -34);
                var textPos2Shad = start + new Vector2(41, -33);


                Drawing.DrawText(text, textPosShad, new Vector2(21, 20), Color.Black, FontFlags.AntiAlias | FontFlags.DropShadow);
                Drawing.DrawText(text, textPos, new Vector2(21, 20), Color.White, FontFlags.AntiAlias | FontFlags.DropShadow);

                Drawing.DrawText(text2, textPos2Shad, new Vector2(21, 21), Color.Black, FontFlags.AntiAlias | FontFlags.DropShadow);
                Drawing.DrawText(text2, textPos2, new Vector2(21, 21), Color.White, FontFlags.AntiAlias | FontFlags.DropShadow);
            }
        }
コード例 #30
0
 private static void DrawDangeItems()
 {
     foreach (var hero in Manager.HeroManager.GetEnemyViableHeroes())
     {
         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;
         foreach (
             var item in
             Manager.HeroManager.GetItemList(hero)
             .Where(x => Members.Menu.Item("dangitems.List").GetValue <AbilityToggler>().IsEnabled(x.Name))
             )
         {
             var itemname = string.Format("materials/ensage_ui/items/{0}.vmat",
                                          item.Name.Replace("item_", ""));
             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;
         }
     }
 }