示例#1
0
        private static void Drawing_OnDraw(EventArgs args)
        {
            if (!Game.IsInGame || _me == null || !_loaded) return;

            #region Set Screen Size init

            if (_screenSizeVector2.X == 0)
            {
                _screenSizeVector2 = new Vector2(Drawing.Width, Drawing.Height);
                PrintSuccess(string.Format(">> OI: init screen size: {0}x{1} -> {2}", _screenSizeVector2.X,
                    _screenSizeVector2.Y, (int) Math.Floor((decimal) (_screenSizeVector2.X/_screenSizeVector2.Y*100))));
                switch ((int) Math.Floor((decimal) (_screenSizeVector2.X/_screenSizeVector2.Y*100)))
                {
                    case 177:
                        _drawHelper = _screenSizeVector2.X == 1600
                            ? new ScreenSizer(494 - 439, 885 - 713, 7, 35, 439, new Vector2(1524, 46)) //1600x1900
                            : _drawHelper =
                                _screenSizeVector2.X == 1360
                                    ? new ScreenSizer(418 - 371, 753 - 605, 7, 29, 371, new Vector2(1288, 43))
                                    //1360x768
                                    : _drawHelper =
                                        _screenSizeVector2.X == 1280
                                            ? new ScreenSizer(395 - 351, 709 - 568, 5, 28, 350, new Vector2(1216, 40))
                                            //1280x720
                                            : _screenSizeVector2.X == 1366
                                                ? new ScreenSizer(422-374, 756 - 609, 7, 29, 374, new Vector2(1314, 39)) //1366

                                                : new ScreenSizer(66, 1063 - 855, 7, 43, 528, new Vector2(1860, 49)); //1920x1080

                        break;
                    case 166:
                        _drawHelper = new ScreenSizer(66, 1063 - 855, 7, 43, 528, new Vector2(1860, 49));
                        break;
                    case 160:
                        _drawHelper = new ScreenSizer(482 - 419, 941 - 738, 7, 42, 419, new Vector2(1610, 49));
                            //1680 x 1050
                        break;
                    case 133:
                        _drawHelper = new ScreenSizer(66, 1063 - 855, 7, 43, 528, new Vector2(1860, 49));
                        break;
                    case 125:
                        _drawHelper = new ScreenSizer(66, 1063 - 855, 7, 43, 528, new Vector2(1860, 49));
                        break;
                    default:
                        _drawHelper = new ScreenSizer(66, 1063 - 855, 7, 43, 528, new Vector2(1860, 49));
                        break;
                }
            }

            #endregion

            #region Show me more cast

            //List<Unit> dummy;
            if (ShowMeMore)
            {
                var dummy = ObjectMgr.GetEntities<Unit>().Where(x => x.ClassID == ClassID.CDOTA_BaseNPC).ToList();
                foreach (var t in dummy)
                {
                    for (var n = 0; n <= 4; n++)
                    {
                        try
                        {
                            var mod = t.Modifiers.FirstOrDefault(x => x.Name == _showMeMore[n].Modifier);
                            if (mod == null) continue;
                            ParticleEffect effect;
                            if (!ShowMeMoreEffect.TryGetValue(t, out effect))
                            {
                                effect = t.AddParticleEffect(@"particles\ui_mouseactions\range_display.vpcf");
                                effect.SetControlPoint(1, new Vector3(_showMeMore[n].Range, 0, 0));
                                ShowMeMoreEffect.Add(t, effect);
                                new ParticleEffect(@"particles/units/heroes" + _showMeMore[n].EffectName + ".vpcf",
                                    t.Position);
                            }
                            break;
                        }
                        catch (Exception)
                        {

                        }

                    }
                }
            }

            #endregion

            uint i;
            for (i = 0; i < 10; i++)
                {
                    try
                    {
                        #region Settings and Checking

                        var v = ObjectMgr.GetPlayerById(i).Hero;
                        if (OverlayOnlyOnEnemy && v.Team == _me.Team) continue;
                        if (v == null || !v.IsAlive) continue;
                        var initPos = i >= 5
                            ? (_drawHelper.RangeBetween + _drawHelper.FloatRange*i) + _drawHelper.Space
                            : (_drawHelper.RangeBetween + _drawHelper.FloatRange*i);
                        var healthDelta = new Vector2((float) v.Health*_drawHelper.FloatRange/v.MaximumHealth, 0);
                        var manaDelta = new Vector2(v.Mana*_drawHelper.FloatRange/v.MaximumMana, 0);

                        #endregion

                        #region ShowHealthOnTopPanel

                        if (ShowHealthOnTopPanel)
                        {
                            Drawing.DrawRect(new Vector2(initPos, _drawHelper.BotRange + 1),
                                new Vector2(_drawHelper.FloatRange, _drawHelper.Height),
                                Color.Red);
                            Drawing.DrawRect(new Vector2(initPos, _drawHelper.BotRange + 1),
                                healthDelta + new Vector2(0, _drawHelper.Height),
                                Color.Green);
                            Drawing.DrawRect(new Vector2(initPos, _drawHelper.BotRange + 1),
                                new Vector2(_drawHelper.FloatRange, _drawHelper.Height),
                                Color.Black, true);
                        }

                        #endregion

                        #region ShowManaOnTopPanel

                        if (ShowManaOnTopPanel)
                        {
                            Drawing.DrawRect(new Vector2(initPos, _drawHelper.BotRange + 1 + _drawHelper.Height),
                                new Vector2(_drawHelper.FloatRange, _drawHelper.Height), Color.Gray);
                            Drawing.DrawRect(new Vector2(initPos, _drawHelper.BotRange + 1 + _drawHelper.Height),
                                manaDelta + new Vector2(0, _drawHelper.Height), Color.Blue);
                            Drawing.DrawRect(new Vector2(initPos, _drawHelper.BotRange + 1 + _drawHelper.Height),
                                new Vector2(_drawHelper.FloatRange, _drawHelper.Height),
                                Color.Black, true);
                        }

                        #endregion

                        #region ShowMeMore

                        if (ShowMeMore)
                        {
                            switch (v.ClassID)
                            {
                                case ClassID.CDOTA_Unit_Hero_Mirana:
                                    //ArrowF(cast, team, v.visible, "mirana");
                                    var arrow = ObjectMgr.GetEntities<Unit>().FirstOrDefault(x => x.ClassID == ClassID.CDOTA_BaseNPC && x.DayVision == 650/* && x.Team!=_me.Team*/);

                                    if (arrow != null)
                                    {
                                        if (!InSystem.Contains(arrow))
                                        {
                                            ArrowS = arrow.Position;
                                            PrintError("first");
                                            InSystem.Add(arrow);
                                        }
                                        else if (Utils.SleepCheck("Arrow"))
                                        {
                                            var e = new ParticleEffect[148];
                                            var ret = FindRet(ArrowS, arrow.Position);
                                            PrintError("second");
                                            for (var z = 1; z <= 147; z++)
                                            {
                                                var p = FindVector(ArrowS, ret, 20*z + 60);
                                                e[z] = new ParticleEffect(@"particles\ui_mouseactions\draw_commentator.vpcf", p);
                                                e[z].SetControlPoint(1, new Vector3(255, 255, 255));
                                                e[z].SetControlPoint(0, p);
                                            }

                                            Utils.Sleep(300, "Arrow");
                                            PrintError("third");
                                        }
                                    }
                                    break;
                                case ClassID.CDOTA_Unit_Hero_SpiritBreaker:
                                    //ChargeF(cast, team, v.visible, v: GetAbility(1), hero, "spirit_breaker");
                                    break;
                                case ClassID.CDOTA_Unit_Hero_Windrunner:
                                    if (true)//(Utils.SleepCheck("ArrowWindRun"))
                                    {
                                        var spell = v.Spellbook.Spell2;
                                        if (spell != null && spell.Cooldown != 0)
                                        {
                                            var cd = Math.Floor(spell.Cooldown*100);
                                            if (cd < 880)
                                            {
                                                ParticleEffect effect;
                                                if (!InSystem.Contains(v))
                                                {
                                                    if (cd > 720)
                                                    {
                                                        var eff = new ParticleEffect[148];
                                                        for (var z = 1; z <= 140; z++)
                                                        {
                                                            try
                                                            {
                                                                var p = new Vector3(
                                                                v.Position.X + 100 * z * (float)Math.Cos(v.RotationRad),
                                                                v.Position.Y + 100 * z * (float)Math.Sin(v.RotationRad),
                                                                100);
                                                                eff[z] =
                                                                    new ParticleEffect(
                                                                        @"particles\ui_mouseactions\draw_commentator.vpcf",
                                                                        p);
                                                                eff[z].SetControlPoint(1, new Vector3(255, 255, 255));
                                                                eff[z].SetControlPoint(0, p);
                                                                Eff[z].Add(v, eff[z]);
                                                            }
                                                            catch (Exception ex)
                                                            {
                                                                PrintSuccess(ex.ToString());
                                                            }

                                                        }
                                                        InSystem.Add(v);
                                                    }
                                                }
                                                else if( cd < 720 || !v.IsAlive)
                                                {
                                                    InSystem.Remove(v);
                                                    for (var z = 1; z <= 140; z++)
                                                    {
                                                        ParticleEffect eff;
                                                        if (Eff[z].TryGetValue(v, out eff))
                                                        {
                                                            eff.Dispose();
                                                            Eff[z].Clear();
                                                        }
                                                    }

                                                }
                                            }
                                        }
                                    }
                                    break;
                                case ClassID.CDOTA_Unit_Hero_Pudge:
                                    //InfestF(team, hero, "life_stealer");
                                    break;
                                case ClassID.CDOTA_Unit_Hero_Kunkka:
                                    //InfestF(team, hero, "life_stealer");
                                    break;
                            }
                        }

                        #endregion

                        #region Spell Panel

                        if (Equals(v, _me)) continue;
                        Vector2 screenPos;

                        #region GettingSPells

                        var spells = new Ability[7];
                        try
                        {
                            spells[1] = v.Spellbook.Spell1;
                        }
                        catch
                        {
                        }
                        try
                        {
                            spells[2] = v.Spellbook.Spell2;
                        }
                        catch
                        {
                        }
                        try
                        {
                            spells[3] = v.Spellbook.Spell3;
                        }
                        catch
                        {
                        }
                        try
                        {
                            spells[4] = v.Spellbook.Spell4;
                        }
                        catch
                        {
                        }
                        try
                        {
                            spells[5] = v.Spellbook.Spell5;
                        }
                        catch
                        {
                        }
                        try
                        {
                            spells[6] = v.Spellbook.Spell6;
                        }
                        catch
                        {
                        }

                        #endregion
                        var counter = 0;
                        if (Drawing.WorldToScreen(v.Position, out screenPos))
                        {
                            var start = screenPos + new Vector2(-75, 20);
                            if (v.IsVisible)
                            {
                                for (var g = 6; g >= 1; g--)
                                {
                                    if (spells[g] == null) continue;
                                    counter++;
                                    var cd = spells[g].Cooldown;
                                    Drawing.DrawRect(start + new Vector2(g*20 - 5, 0), new Vector2(20, cd == 0 ? 6 : 20),
                                        new ColorBGRA(0, 0, 0, 100), true);
                                    //PrintError(String.Format("Spell # {0}:{1}", g, spells[g].AbilityState));
                                    if (spells[g].AbilityState == AbilityState.NotEnoughMana)
                                    {
                                        Drawing.DrawRect(start + new Vector2(g*20 - 5, 0),
                                            new Vector2(20, cd == 0 ? 6 : 20),
                                            new ColorBGRA(0, 0, 150, 150));
                                    }
                                    if (cd > 0)
                                    {
                                        var text = string.Format("{0:0.#}", cd);
                                        var textSize = Drawing.MeasureText(text, "Arial", new Vector2(10, 200),
                                            FontFlags.None);
                                        var textPos = (start + new Vector2(g*20 - 5, 0) +
                                                       new Vector2(10 - textSize.X/2, -textSize.Y/2 + 12));
                                        Drawing.DrawText(text, textPos, new Vector2(10, 150), Color.White,
                                            FontFlags.AntiAlias | FontFlags.DropShadow);
                                    }
                                    if (spells[g].Level == 0) continue;
                                    for (var lvl = 1; lvl <= spells[g].Level; lvl++)
                                    {

                                        Drawing.DrawRect(start + new Vector2(g*20 - 5 + 3*lvl, 2), new Vector2(2, 2),
                                            new ColorBGRA(255, 255, 0, 255), true);
                                    }
                                }
                            }
                        }

                        #endregion

                        #region Ultimate Cooldown

                        if (counter >= 4 && ShowCooldownOnTopPanel && spells[counter].Level > 0)
                        {
                            var spellDelta =
                                new Vector2(
                                    spells[counter].Cooldown*_drawHelper.FloatRange/spells[counter].CooldownLength, 0);
                            Drawing.DrawRect(new Vector2(initPos, _drawHelper.BotRange + 1 + _drawHelper.Height*2),
                                new Vector2(_drawHelper.FloatRange, _drawHelper.Height), Color.Gray);
                            Drawing.DrawRect(new Vector2(initPos, _drawHelper.BotRange + 1 + _drawHelper.Height*2),
                                spellDelta + new Vector2(0, _drawHelper.Height), Color.Yellow);
                            Drawing.DrawRect(new Vector2(initPos, _drawHelper.BotRange + 1 + _drawHelper.Height*2),
                                new Vector2(_drawHelper.FloatRange, _drawHelper.Height), Color.Black, true);
                            var text = string.Format("{0:0.}", spells[counter].Cooldown);
                            var textSize = Drawing.MeasureText(text, "Arial", new Vector2(10, 200), FontFlags.None);
                            var textPos = (new Vector2(initPos, _drawHelper.BotRange + 1 + _drawHelper.Height*2) +
                                           new Vector2(textSize.X/2 + 5, -textSize.Y/2 + 10));
                            if (ShowCooldownOnTopPanelLikeText)
                            {
                                Drawing.DrawText(text == "0" ? "Ready" : text, textPos, new Vector2(10, 150),
                                    Color.White,
                                    FontFlags.AntiAlias | FontFlags.DropShadow);
                            }
                        }

                        #endregion

                    }
                    catch (Exception)
                    {
                        // ignored
                    }
                }
        }
示例#2
0
        private static void Drawing_OnDraw(EventArgs args)
        {
            if (!Game.IsInGame || _me == null || !_loaded) return;
            if (_screenSizeVector2.X==0)
            {
                _screenSizeVector2=new Vector2(Drawing.Width,Drawing.Height);
                PrintSuccess(string.Format(">> OI: init screen size: {0}x{1} -> {2}", _screenSizeVector2.X,
                    _screenSizeVector2.Y, (int) Math.Floor((decimal) (_screenSizeVector2.X/_screenSizeVector2.Y*100))));
                switch ((int) Math.Floor((decimal) (_screenSizeVector2.X/_screenSizeVector2.Y*100)))
                {
                    case 177:
                        _drawHelper = _screenSizeVector2.X == 1600
                            ? new ScreenSizer(494 - 439, 885 - 713, 7, 35, 439, new Vector2(1524, 46)) //1600x1900
                            : _drawHelper =
                                _screenSizeVector2.X == 1360
                                    ? new ScreenSizer(418 - 371, 753 - 605, 7, 29, 371, new Vector2(1288, 43))
                                    //1360x768
                                    : _drawHelper =
                                        _screenSizeVector2.X == 1280
                                            ? new ScreenSizer(395 - 351, 709 - 568, 5, 28, 350, new Vector2(1216, 40))
                                            //1280x720
                                            : new ScreenSizer(66, 1063 - 855, 7, 43, 528, new Vector2(1860, 49)); //1920x1080

                        break;
                    case 166:
                        _drawHelper = new ScreenSizer(66, 1063 - 855, 7, 43, 528, new Vector2(1860, 49));
                        break;
                    case 160:
                        _drawHelper = new ScreenSizer(482 - 419, 941 - 738, 7, 42, 419, new Vector2(1610, 49)); //1680 x 1050
                        break;
                    case 133:
                        _drawHelper = new ScreenSizer(66, 1063 - 855, 7, 43, 528, new Vector2(1860, 49));
                        break;
                    case 125:
                        _drawHelper = new ScreenSizer(66, 1063 - 855, 7, 43, 528, new Vector2(1860, 49));
                        break;
                    default:
                        _drawHelper = new ScreenSizer(66, 1063 - 855, 7, 43, 528, new Vector2(1860, 49));
                        break;
                }
            }

            uint i;
            for (i = 0; i < 10; i++)
                {
                    try
                    {
                        var v = ObjectMgr.GetPlayerById(i).Hero;
                        if (OverlayOnlyOnEnemy && v.Team==_me.Team) continue;
                        if (v == null || !v.IsAlive) continue;
                        var initPos = i >= 5
                            ? (_drawHelper.RangeBetween + _drawHelper.FloatRange*i) + _drawHelper.Space
                            : (_drawHelper.RangeBetween + _drawHelper.FloatRange*i);
                        var healthDelta = new Vector2((float)v.Health * _drawHelper.FloatRange / v.MaximumHealth, 0);
                        var manaDelta = new Vector2(v.Mana * _drawHelper.FloatRange / v.MaximumMana, 0);
                        if (ShowHealthOnTopPanel)
                        {
                            Drawing.DrawRect(new Vector2(initPos, _drawHelper.BotRange + 1), new Vector2(_drawHelper.FloatRange, _drawHelper.Height),
                                Color.Red);
                            Drawing.DrawRect(new Vector2(initPos, _drawHelper.BotRange + 1), healthDelta + new Vector2(0, _drawHelper.Height),
                                Color.Green);
                            Drawing.DrawRect(new Vector2(initPos, _drawHelper.BotRange + 1), new Vector2(_drawHelper.FloatRange, _drawHelper.Height),
                                Color.Black, true);
                        }
                        if (ShowManaOnTopPanel)
                        {
                            Drawing.DrawRect(new Vector2(initPos, _drawHelper.BotRange + 1 + _drawHelper.Height),
                                new Vector2(_drawHelper.FloatRange, _drawHelper.Height), Color.Gray);
                            Drawing.DrawRect(new Vector2(initPos, _drawHelper.BotRange + 1 + _drawHelper.Height),
                                manaDelta + new Vector2(0, _drawHelper.Height), Color.Blue);
                            Drawing.DrawRect(new Vector2(initPos, _drawHelper.BotRange + 1 + _drawHelper.Height),
                                new Vector2(_drawHelper.FloatRange, _drawHelper.Height),
                                Color.Black, true);
                        }

                        if ( !v.IsVisible|| Equals(v, _me)) continue;
                        Vector2 screenPos;

                        if (!Drawing.WorldToScreen(v.Position, out screenPos))
                            continue;

                        var start = screenPos + new Vector2(-75, 20);
                        var spells = new Ability[7];
                        try { spells[1] = v.Spellbook.Spell1; }
                        catch { }
                        try { spells[2] = v.Spellbook.Spell2; }
                        catch { }
                        try { spells[3] = v.Spellbook.Spell3; }
                        catch { }
                        try { spells[4] = v.Spellbook.Spell4; }
                        catch { }
                        try { spells[5] = v.Spellbook.Spell5; }
                        catch { }
                        try { spells[6] = v.Spellbook.Spell6; }
                        catch { }
                        var counter = 0;
                        for (var g = 6; g >= 1; g--)
                        {
                            if (spells[g]==null) continue;
                            counter++;
                            var cd = spells[g].Cooldown;
                            Drawing.DrawRect(start + new Vector2(g * 20 - 5, 0), new Vector2(20, cd==0?6:20),
                                new ColorBGRA(0, 0, 0, 100), true);
                            //PrintError(String.Format("Spell # {0}:{1}", g, spells[g].AbilityState));
                            if (spells[g].AbilityState == AbilityState.NotEnoughMana)
                            {
                                Drawing.DrawRect(start + new Vector2(g*20 - 5, 0), new Vector2(20, cd == 0 ? 6 : 20),
                                    new ColorBGRA(0, 0, 150, 150));
                            }
                            if (cd > 0)
                            {
                                var text = string.Format("{0:0.#}", cd);
                                var textSize = Drawing.MeasureText(text, "Arial", new Vector2(10, 200), FontFlags.None);
                                var textPos = (start + new Vector2(g * 20 - 5, 0) + new Vector2(10 - textSize.X / 2, -textSize.Y / 2 + 12));
                                Drawing.DrawText(text, textPos, new Vector2(10, 150), Color.White,
                                    FontFlags.AntiAlias | FontFlags.DropShadow);
                            }
                            if (spells[g].Level==0) continue;
                            for (var lvl = 1; lvl <= spells[g].Level; lvl++)
                            {

                                Drawing.DrawRect(start + new Vector2(g * 20 - 5 + 3 * lvl, 2), new Vector2(2, 2),
                                    new ColorBGRA(255, 255, 0, 255),true);
                            }
                        }
                        if (counter >= 4 && ShowCooldownOnTopPanel && spells[counter].Level>0)
                        {
                            var spellDelta =
                                new Vector2(spells[counter].Cooldown * _drawHelper.FloatRange / spells[counter].CooldownLength, 0);
                            Drawing.DrawRect(new Vector2(initPos, _drawHelper.BotRange + 1 + _drawHelper.Height * 2),
                                new Vector2(_drawHelper.FloatRange, _drawHelper.Height), Color.Gray);
                            Drawing.DrawRect(new Vector2(initPos, _drawHelper.BotRange + 1 + _drawHelper.Height * 2),
                                spellDelta + new Vector2(0, _drawHelper.Height), Color.Yellow);
                            Drawing.DrawRect(new Vector2(initPos, _drawHelper.BotRange + 1 + _drawHelper.Height * 2),
                                new Vector2(_drawHelper.FloatRange, _drawHelper.Height), Color.Black, true);
                            var text = string.Format("{0:0.}", spells[counter].Cooldown);
                            var textSize = Drawing.MeasureText(text, "Arial", new Vector2(10, 200), FontFlags.None);
                            var textPos = (new Vector2(initPos, _drawHelper.BotRange + 1 + _drawHelper.Height*2) +
                                           new Vector2(textSize.X/2 + 5, -textSize.Y/2 + 10));
                            if (ShowCooldownOnTopPanelLikeText)
                            {
                                Drawing.DrawText(text=="0"?"Ready":text, textPos, new Vector2(10, 150), Color.White,
                                    FontFlags.AntiAlias | FontFlags.DropShadow);
                            }
                        }

                    }
                    catch (Exception)
                    {
                        // ignored
                    }
                }
        }