Beispiel #1
0
            public static void Update(EventArgs args)
            {
                if (!Checker.IsActive())
                {
                    return;
                }
                if (!_courUpdater.Sleeping)
                {
                    _courUpdater.Sleep(100);
                    Members.CourList =
                        ObjectManager.GetEntities <Courier>().Where(x => x.Team != Members.MyHero.Team).ToList();
                    foreach (var courier in Members.CourList)
                    {
                        if (Members.ItemDictionary.ContainsValue(
                                courier.Inventory.Items.Where(x => x.IsValid).ToList()))
                        {
                            continue;
                        }
                        var items = courier.Inventory.Items.ToList();
                        Members.ItemDictionary.Remove(courier.Handle);
                        Members.ItemDictionary.Add(courier.Handle,
                                                   items.Where(x => x.IsValid).ToList());
                    }
                }
                if (!_heroUpdate.Sleeping)
                {
                    /*foreach (var enemyHero in Members.EnemyHeroes)
                     * {
                     *  var worth = enemyHero.Inventory.Items.Aggregate<Item, long>(0, (current, item) => current + item.Cost);
                     *  Printer.Print(enemyHero.Name + " --> " + worth);
                     * }*/
                    _heroUpdate.Sleep(2000);
                    if (Members.Heroes.Count < 10 + (Members.MeepoDivided != null ? Members.MeepoDivided.UnitCount - 1 : 0))
                    {
                        /*Members.Heroes =
                         *  Heroes.All.Where(
                         *      x =>
                         *          x != null && x.IsValid && !x.IsIllusion && !IgnoreList.Contains(x.StoredName())).ToList();*/
                        Members.Heroes =
                            HeroesList.All.Where(
                                x =>
                                x != null && x.IsValid && !x.IsIllusion && !IgnoreList.Contains(x.StoredName()))
                            .ToList();

                        /*Printer.Print($"---------------");
                         * foreach (var source in Members.Heroes.Where(x=>x.ClassId == ClassId.CDOTA_Unit_Hero_Meepo))
                         * {
                         *  var hero = source as Meepo;
                         *  var isIllusion = hero.IsIllusion();
                         *  if (hero != null) Printer.Print($"Hero({isIllusion}): {hero.Name}");
                         * }*/
                        /*Members.Heroes =
                         *  ObjectManager.GetEntities<Hero>().Where(
                         *      x =>
                         *          x != null && x.IsValid && !x.IsIllusion && !IgnoreList.Contains(x.StoredName())).ToList();*/

                        foreach (
                            var meepo in
                            Members.Heroes.Where(
                                x =>
                        {
                            var dividedWeStand = x.Spellbook.SpellR as DividedWeStand;
                            return(dividedWeStand != null && !Members.MeepoIgnoreList.Contains(x) &&
                                   x.ClassId == ClassId.CDOTA_Unit_Hero_Meepo &&
                                   dividedWeStand.UnitIndex > 0);
                        }))
                        {
                            Members.MeepoIgnoreList.Add(meepo);
                        }
                        Members.AllyHeroes  = Members.Heroes.Where(x => x.Team == Members.MyHero.Team).ToList();
                        Members.EnemyHeroes =
                            Members.Heroes.Where(x => x.Team == Members.MyHero.GetEnemyTeam()).ToList();
                        //Printer.Print($"Heroes.All: {Heroes.All.Count}; Members.Heroes: {Members.Heroes.Count}");
                        //Printer.Print("STATUS:[all] " + Members.Heroes.Count+ " [enemy] " + Members.EnemyHeroes.Count + " [ally] " + Members.AllyHeroes.Count);
                        if (!Members.Apparition &&
                            Members.EnemyHeroes.Any(x => x.ClassId == ClassId.CDOTA_Unit_Hero_AncientApparition))
                        {
                            Printer.Print("Apparition detected");
                            Members.Apparition = true;
                        }
                        if (Members.PAisHere == null &&
                            Members.EnemyHeroes.Any(x => x.ClassId == ClassId.CDOTA_Unit_Hero_PhantomAssassin))
                        {
                            Printer.Print("PhantomAssss detected");
                            Members.PAisHere = Members.EnemyHeroes.FirstOrDefault(x => x.ClassId == ClassId.CDOTA_Unit_Hero_PhantomAssassin);
                        }
                        if (!Members.BaraIsHere &&
                            Members.EnemyHeroes.Any(x => x.ClassId == ClassId.CDOTA_Unit_Hero_SpiritBreaker))
                        {
                            Printer.Print("BaraIsHere detected");
                            Members.BaraIsHere = true;
                        }
                        if (Members.Mirana == null &&
                            Members.EnemyHeroes.Any(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Mirana))
                        {
                            Printer.Print("Mirana detected");
                            Members.Mirana = Members.EnemyHeroes.FirstOrDefault(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Mirana);
                        }
                        if (Members.Windrunner == null &&
                            Members.EnemyHeroes.Any(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Windrunner))
                        {
                            Printer.Print("Windrunner detected");
                            Members.Windrunner = Members.EnemyHeroes.FirstOrDefault(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Windrunner);
                        }
                        if (Members.Invoker == null &&
                            Members.EnemyHeroes.Any(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Invoker))
                        {
                            Printer.Print("Invoker detected");
                            Members.Invoker = Members.EnemyHeroes.FirstOrDefault(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Invoker);
                        }
                        if (Members.Kunkka == null &&
                            Members.EnemyHeroes.Any(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Kunkka))
                        {
                            Printer.Print("Kunkka detected");
                            Members.Kunkka = Members.EnemyHeroes.FirstOrDefault(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Kunkka);
                        }
                        if (Members.Lina == null &&
                            Members.EnemyHeroes.Any(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Lina))
                        {
                            Printer.Print("Lina detected");
                            Members.Lina = Members.EnemyHeroes.FirstOrDefault(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Lina);
                        }
                        if (Members.Leshrac == null &&
                            Members.EnemyHeroes.Any(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Leshrac))
                        {
                            Printer.Print("Leshrac detected");
                            Members.Leshrac = Members.EnemyHeroes.FirstOrDefault(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Leshrac);
                        }
                        if (Members.LifeStealer == null &&
                            Members.EnemyHeroes.Any(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Life_Stealer))
                        {
                            Printer.Print("LifeStealer detected");
                            Members.LifeStealer = Members.EnemyHeroes.FirstOrDefault(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Life_Stealer);
                        }

                        if (Members.Techies == null &&
                            Members.EnemyHeroes.Any(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Techies))
                        {
                            Printer.Print("Techies detected");
                            Members.Techies = Members.EnemyHeroes.FirstOrDefault(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Techies);
                        }
                        if (Members.Tinker == null &&
                            Members.EnemyHeroes.Any(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Tinker))
                        {
                            Printer.Print("Tinker detected");
                            Members.Tinker = Members.EnemyHeroes.FirstOrDefault(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Tinker);
                        }
                        if (Members.ArcWarden == null &&
                            Members.EnemyHeroes.Any(x => x.ClassId == ClassId.CDOTA_Unit_Hero_ArcWarden))
                        {
                            Printer.Print("ArcWarden detected");
                            Members.ArcWarden = Members.EnemyHeroes.FirstOrDefault(x => x.ClassId == ClassId.CDOTA_Unit_Hero_ArcWarden);
                        }
                        //DividedWeStand
                        if (Members.Meepo == null &&
                            Members.Heroes.Any(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Meepo))
                        {
                            Printer.Print("Meepo detected");
                            Members.Meepo        = Members.Heroes.FirstOrDefault(x => x.ClassId == ClassId.CDOTA_Unit_Hero_Meepo);
                            Members.MeepoDivided = (DividedWeStand)Members.Meepo.Spellbook.SpellR;
                        }
                    }
                }
                if (!_updatePrediction.Sleeping /*&& Members.Menu.Item("lastPosition.Enable.Prediction").GetValue<bool>()*/)
                {
                    _updatePrediction.Sleep(1);
                    var time = Game.GameTime;
                    foreach (var v in Members.EnemyHeroes.Where(x => x.IsAlive))
                    {
                        if (v.IsVisible)
                        {
                            if (Members.PredictionTimes.ContainsKey(v.StoredName()))
                            {
                                Members.PredictionTimes.Remove(v.StoredName());
                            }
                        }
                        else
                        {
                            float test;
                            if (!Members.PredictionTimes.TryGetValue(v.StoredName(), out test))
                            {
                                Members.PredictionTimes.Add(v.StoredName(), time);
                            }

                            /*else
                             * {
                             *  Members.PredictionTimes[v.StoredName()] = time;
                             * }*/
                        }
                    }
                }
                if (!_abilityUpdate.Sleeping)
                {
                    _abilityUpdate.Sleep(1000);
                    foreach (var hero in /*Members.Heroes */ Manager.HeroManager.GetViableHeroes())
                    {
                        /*if ((hero.ClassId==ClassId.CDOTA_Unit_Hero_DoomBringer || hero.ClassId==ClassId.CDOTA_Unit_Hero_Rubick) && !hero.IsVisible)
                         *  continue;*/
                        try
                        {
                            if (!Members.AbilityDictionary.ContainsKey(hero.Handle))
                            {
                                Members.AbilityDictionary.Add(hero.Handle,
                                                              hero.Spellbook.Spells.Where(
                                                                  x =>
                                                                  x != null && x.IsValid && x.AbilityType != AbilityType.Attribute && x.AbilityType != AbilityType.Hidden &&
                                                                  x.AbilitySlot.ToString() != "-1")
                                                              .ToList());
                            }
                            if (
                                !Members.AbilityDictionary.ContainsValue(
                                    hero.Spellbook.Spells.Where(x => x.AbilitySlot.ToString() != "-1").ToList()))
                            {
                                Members.AbilityDictionary.Remove(hero.Handle);
                                Members.AbilityDictionary.Add(hero.Handle, hero.Spellbook.Spells.Where(
                                                                  x =>
                                                                  x.IsValid && x.AbilityType != AbilityType.Attribute && x.AbilityType != AbilityType.Hidden &&
                                                                  x.AbilitySlot.ToString() != "-1")
                                                              .ToList());
                            }
                            long worth = 0;

                            /*if ((hero.ClassId == ClassId.CDOTA_Unit_Hero_Meepo) &&
                             *  (hero.FindSpell("meepo_divided_we_stand") as DividedWeStand).UnitIndex > 0)
                             * {
                             *  continue;
                             * }*/
                            if (Members.MeepoIgnoreList.Contains(hero))
                            {
                                continue;
                            }
                            Members.NetWorthDictionary.Remove(hero.StoredName());
                            if (!Members.ItemDictionary.ContainsValue(
                                    hero.Inventory.Items.Where(x => x.IsValid).ToList()))
                            {
                                var items = hero.Inventory.Items.ToList();
                                Members.ItemDictionary.Remove(hero.Handle);
                                Members.ItemDictionary.Add(hero.Handle,
                                                           items.Where(x => x.IsValid).ToList());
                                worth += items.Aggregate <Item, long>(0, (current, item) => current + item.Cost);
                            }
                            if ((Members.Menu.Item("itempanel.Stash.Enable").GetValue <bool>() || Members.Menu.Item("netWorth.Enable").GetValue <bool>()) &&
                                !Members.StashItemDictionary.ContainsValue(
                                    hero.Inventory.Stash.Where(x => x.IsValid).ToList()))
                            {
                                var items = hero.Inventory.Stash.ToList();
                                Members.StashItemDictionary.Remove(hero.Handle);
                                Members.StashItemDictionary.Add(hero.Handle,
                                                                items.Where(x => x.IsValid).ToList());
                                worth += items.Aggregate <Item, long>(0, (current, item) => current + item.Cost);
                            }
                            Members.NetWorthDictionary.Add(hero.StoredName(), worth);
                        }
                        catch (Exception)
                        {
                            Printer.Print("[UPDATER.ITEMS/ABILITY: ] " + hero.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 => IsAbilityEnable(x.StoredName()) && x.StoredName() == "item_ethereal_blade" && x.CanBeCasted());
            var haveVeil =
                InSys.Any(
                    x => IsAbilityEnable(x.StoredName()) && x.StoredName() == "item_veil_of_discord" && x.CanBeCasted());
            var myPhysDmg = 0;

            if (Members.MyHero.ClassID == ClassID.CDOTA_Unit_Hero_MonkeyKing)
            {
                var extraMkAbility = Members.MyHero.FindSpell("special_bonus_unique_monkey_king", true)?.Level == 1;
                var passiveDmg     = MkDmg[Members.MyHero.FindSpell("monkey_king_jingu_mastery", true).Level];
                myPhysDmg = Members.MyHero.MinimumDamage + Members.MyHero.BonusDamage +
                            (Members.MyHero.HasModifier("modifier_monkey_king_quadruple_tap_bonuses")
                                    ? passiveDmg
                                    : 0);

                myPhysDmg *= extraMkAbility ? 3 : 2;
            }
            foreach (var v in Manager.HeroManager.GetEnemyViableHeroes())
            {
                try
                {
                    var pos = HUDInfo.GetHPbarPosition(v);
                    if (pos.IsZero)
                    {
                        continue;
                    }
                    var extraDamage = haveEb && !v.HasModifier("modifier_item_ethereal_blade_ethereal") ? 40 : 0;
                    extraDamage += haveVeil && !v.HasModifier("modifier_item_veil_of_discord_debuff") ? 25 : 0;
                    var myDmg = InSys.Where(x => x.CanBeCasted() && IsAbilityEnable(x.StoredName()))
                                .Sum(
                        x => WhiteList.Contains(x.Name)
                                ? Calculations.DamageTaken(v,
                                                           myPhysDmg,
                                                           DamageType.Physical, Members.MyHero)
                                : AbilityDamage.CalculateDamage(x, Members.MyHero, v,
                                                                minusMagicResistancePerc: extraDamage));

                    var health    = v.Health;
                    var extraLife =
                        (uint)(Manager.HeroManager.GetItemList(v)
                               .Any(x => x.StoredName() == "item_infused_raindrop" && x.Cooldown <= 0)
                            ? 120
                            : 0);
                    if (extraLife > 100)
                    {
                        var needToCalcExtraLife =
                            InSys.Any(
                                x =>
                                x.DamageType == DamageType.Magical &&
                                AbilityDamage.CalculateDamage(x, Members.MyHero, v,
                                                              minusMagicResistancePerc: haveEb ? 40 : 0) > 120);
                        health += needToCalcExtraLife ? extraLife : 0;
                    }

                    var healthAfterShit = (int)(health - myDmg);
                    var size            = HUDInfo.GetHpBarSizeY();
                    var text            = $"{healthAfterShit} ({(int) 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);
                    var isEno   = healthAfterShit < 0;
                    var name    = isEno ? "killableCol" : "defCol";
                    Drawing.DrawText(
                        text,
                        textPos,
                        new Vector2(textSize.Y, 0),
                        new Color(R(name), G(name), B(name), 255),
                        FontFlags.AntiAlias | FontFlags.StrikeOut);
                }
                catch (Exception)
                {
                    Printer.Print($"[DamageCalculation]: {v.StoredName()}");
                }
            }
        }
Beispiel #3
0
        public static void Draw(EventArgs args)
        {
            if (!Checker.IsActive())
            {
                return;
            }
            if (!Members.Menu.Item("showmemore.Enable").GetValue <bool>())
            {
                return;
            }
            if (Members.Menu.Item("Cour.Enable").GetValue <bool>())
            {
                foreach (var courier in Manager.BaseManager.GetViableCouriersList())
                {
                    var pos = Helper.WorldToMinimap(courier.Position);
                    if (pos.IsZero)
                    {
                        continue;
                    }
                    var    courType = courier.IsFlying ? "courier_flying" : "courier";
                    string name     = $"materials/ensage_ui/other/{courType}.vmat";
                    Drawing.DrawRect(pos - new Vector2(7, 7), new Vector2(15, 15), Drawing.GetTexture(name));
                }
            }
            if (Members.Menu.Item("apparition.Enable").GetValue <bool>() && AAunit != null && AAunit.IsValid)
            {
                try
                {
                    var aapos = Drawing.WorldToScreen(AAunit.Position);
                    if (!aapos.IsZero)
                    {
                        var myHeroPos = Drawing.WorldToScreen(Members.MyHero.Position);
                        if (!myHeroPos.IsZero)
                        {
                            Drawing.DrawLine(Drawing.WorldToScreen(Members.MyHero.Position), aapos, Color.AliceBlue);
                            const string name = "materials/ensage_ui/spellicons/ancient_apparition_ice_blast.vmat";
                            Drawing.DrawRect(aapos, new Vector2(50, 50), Drawing.GetTexture(name));
                        }
                    }
                    aapos = Helper.WorldToMinimap(AAunit.Position);
                    if (!aapos.IsZero)
                    {
                        const string name = "materials/ensage_ui/spellicons/ancient_apparition_ice_blast.vmat";
                        var          size = new Vector2(7, 7);
                        Drawing.DrawRect(aapos, size, Textures.GetTexture(name));
                    }
                }
                catch (Exception)
                {
                    Printer.Print("[Draw]: Apparation");
                }
            }
            if (Members.Menu.Item("tinker.Enable").GetValue <bool>())
            {
                try
                {
                    if (Members.Tinker != null && Members.Tinker.IsValid)
                    {
                        var baseList =
                            Manager.BaseManager.GetBaseList()
                            .Where(x => x.IsAlive && x.HasModifier("modifier_tinker_march_thinker"));
                        foreach (var unit in baseList)
                        {
                            var realPos = unit.Position;
                            var pos     = Drawing.WorldToScreen(realPos);
                            var texture = Textures.GetSpellTexture("tinker_march_of_the_machines");
                            if (pos.X > 0 && pos.Y > 0)
                            {
                                Drawing.DrawRect(pos, new Vector2(50, 50), texture);
                            }
                            var pos2 = Helper.WorldToMinimap(realPos);
                            Drawing.DrawRect(pos2, new Vector2(10, 10), texture);
                        }
                    }
                }
                catch (Exception)
                {
                    Printer.Print("[Draw]: Tinker");
                }
            }
            if (Members.Menu.Item("tech.Enable").GetValue <bool>())
            {
                try
                {
                    if (Members.Techies != null && Members.Techies.IsValid)
                    {
                        var baseList =
                            ObjectManager.GetEntities <Unit>()
                            .Where(x => x.IsAlive && x.ClassID == ClassID.CDOTA_NPC_TechiesMines && x.Team != Members.MyHero.Team && !Bombs.Contains(x));
                        foreach (var unit in baseList)
                        {
                            Bombs.Add(unit);
                        }
                        foreach (var bomb in Bombs)
                        {
                            if (!bomb.IsValid)
                            {
                                continue;
                            }
                            if (bomb.IsVisible)
                            {
                                continue;
                            }
                            var realPos = bomb.Position;
                            var pos     = Drawing.WorldToScreen(realPos);
                            var texture = bomb.Spellbook.Spell1 != null
                                ? Textures.GetTexture("materials/ensage_ui/other/npc_dota_techies_remote_mine.vmat")
                                : Textures.GetTexture("materials/ensage_ui/other/npc_dota_techies_land_mine.vmat");

                            if (pos.X > 0 && pos.Y > 0)
                            {
                                Drawing.DrawRect(pos, new Vector2(50, 50), texture);
                            }
                            var pos2 = Helper.WorldToMinimap(realPos);
                            Drawing.DrawRect(pos2, new Vector2(15, 15), texture);
                        }
                    }
                }
                catch (Exception)
                {
                    Printer.Print("[Draw]: Techies");
                }
            }
            if (Members.Menu.Item("scan.Enable").GetValue <bool>())
            {
                if (Members.ScanEnemy != null && Members.ScanEnemy.IsValid)
                {
                    try
                    {
                        var position = Members.ScanEnemy.Position;
                        var w2S      = Drawing.WorldToScreen(position);
                        if (!w2S.IsZero)
                        {
                            Drawing.DrawText(
                                "Scan Ability " +
                                Members.ScanEnemy.FindModifier("modifier_radar_thinker").RemainingTime.ToString("F1"),
                                w2S,
                                new Vector2(15, 15),
                                Color.White,
                                FontFlags.AntiAlias | FontFlags.StrikeOut);
                        }
                    }
                    catch (Exception)
                    {
                        Printer.Print("[Draw]: scan");
                    }
                }
            }
            if (Members.Menu.Item("charge.Enable").GetValue <bool>() && Members.BaraIsHere)
            {
                try
                {
                    foreach (var v in Manager.HeroManager.GetAllyViableHeroes())
                    {
                        var mod = v.HasModifier("modifier_spirit_breaker_charge_of_darkness_vision");
                        if (mod)
                        {
                            if (Equals(Members.MyHero, v))
                            {
                                Drawing.DrawRect(new Vector2(0, 0), new Vector2(Drawing.Width, Drawing.Height),
                                                 new Color(Members.Menu.Item("charge" + ".Red").GetValue <Slider>().Value,
                                                           Members.Menu.Item("charge" + ".Green").GetValue <Slider>().Value,
                                                           Members.Menu.Item("charge" + ".Blue").GetValue <Slider>().Value,
                                                           Members.Menu.Item("charge" + ".Alpha").GetValue <Slider>().Value));
                            }
                            if (!InSys.Contains(v))
                            {
                                Helper.GenerateSideMessage(v.Name.Replace("npc_dota_hero_", ""),
                                                           "spirit_breaker_charge_of_darkness");
                                InSys.Add(v);
                                //effect322 = new ParticleEffect("particles/units/heroes/hero_spirit_breaker/spirit_breaker_charge_target.vpcf", v, ParticleAttachment.OverheadFollow);
                                //v.AddParticleEffect("particles/units/heroes/hero_spirit_breaker/spirit_breaker_charge_target.vpcf");
                            }
                            else
                            {
                                var pos = HUDInfo.GetHPbarPosition(v);
                                if (!pos.IsZero && BaraDrawRect)
                                {
                                    Drawing.DrawRect(pos - new Vector2(50, 0), new Vector2(30, 30),
                                                     Textures.GetSpellTexture("spirit_breaker_charge_of_darkness"));
                                    Drawing.DrawRect(pos - new Vector2(50, 0), new Vector2(30, 30),
                                                     Color.Red, true);
                                }
                            }
                        }
                        else
                        {
                            if (InSys.Contains(v))
                            {
                                InSys.Remove(v);
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Printer.Print("[Draw]: charge " + e.Message);
                }
            }
            if (Members.Menu.Item("lifestealer.Enable").GetValue <bool>() && Members.LifeStealer != null && Members.LifeStealer.IsValid && !Members.LifeStealer.IsVisible)
            {
                try
                {
                    const string modname = "modifier_life_stealer_infest_effect";
                    if (LifeStealerBox)
                    {
                        foreach (var t in Manager.HeroManager.GetEnemyViableHeroes().Where(x => x.HasModifier(modname)))
                        {
                            var size3  = new Vector2(10, 20) + new Vector2(13, -6);
                            var w2SPos = HUDInfo.GetHPbarPosition(t);
                            if (w2SPos.IsZero)
                            {
                                continue;
                            }
                            var name = "materials/ensage_ui/miniheroes/" +
                                       Members.LifeStealer.StoredName().Replace("npc_dota_hero_", "") + ".vmat";
                            Drawing.DrawRect(w2SPos - new Vector2(size3.X / 2, size3.Y / 2), size3,
                                             Drawing.GetTexture(name));
                        }
                    }
                    if (Members.Menu.Item("lifestealer.creeps.Enable").GetValue <bool>())
                    {
                        foreach (var t in Creeps.All.Where(x => x != null && x.IsAlive && x.HasModifier(modname)))
                        {
                            var size3  = new Vector2(10, 20) + new Vector2(13, -6);
                            var w2SPos = HUDInfo.GetHPbarPosition(t);
                            if (w2SPos.IsZero)
                            {
                                continue;
                            }
                            var name = "materials/ensage_ui/miniheroes/" +
                                       Members.LifeStealer.StoredName().Replace("npc_dota_hero_", "") + ".vmat";
                            Drawing.DrawRect(w2SPos - new Vector2(size3.X / 2, size3.Y / 2), size3,
                                             Drawing.GetTexture(name));
                        }
                    }
                }
                catch (Exception)
                {
                    Printer.Print("[Draw]: lifestealer");
                }
            }
            if (Members.Menu.Item("blur.Enable").GetValue <bool>() && Members.PAisHere != null && Members.PAisHere.IsValid)
            {
                try
                {
                    var mod = Members.PAisHere.HasModifier("modifier_phantom_assassin_blur_active");
                    if (mod && Members.PAisHere != null && Members.PAisHere.IsValid)
                    {
                        var size3 = new Vector2(10, 20) + new Vector2(13, -6);
                        var w2M   = Helper.WorldToMinimap(Members.PAisHere.NetworkPosition);
                        var name  = "materials/ensage_ui/miniheroes/" +
                                    Members.PAisHere.StoredName().Replace("npc_dota_hero_", "") + ".vmat";
                        Drawing.DrawRect(w2M - new Vector2(size3.X / 2, size3.Y / 2), size3,
                                         Drawing.GetTexture(name));
                    }
                }
                catch (Exception)
                {
                    Printer.Print("[Draw]: phantom assasin");
                }
            }
        }
Beispiel #4
0
        public static void Draw(EventArgs args)
        {
            if (!Checker.IsActive())
            {
                return;
            }
            if (!Members.Menu.Item("itempanel.Enable").GetValue <bool>())
            {
                return;
            }
            var startPos = new Vector2(Members.Menu.Item("itempanel.X").GetValue <Slider>().Value,
                                       Members.Menu.Item("itempanel.Y").GetValue <Slider>().Value);
            var size = new Vector2(Members.Menu.Item("itempanel.SizeX").GetValue <Slider>().Value *Percent,
                                   Members.Menu.Item("itempanel.SizeY").GetValue <Slider>().Value *Percent);

            Drawing.DrawRect(startPos, size + new Vector2(2, 0), new Color(0, 0, 0, 100));
            var r = Members.Menu.Item("itempanel.Red").GetValue <Slider>().Value;
            var g = Members.Menu.Item("itempanel.Green").GetValue <Slider>().Value;
            var b = Members.Menu.Item("itempanel.Blue").GetValue <Slider>().Value;

            Drawing.DrawRect(startPos, size + new Vector2(2, 0), new Color(r, g, b, 255), true);
            Drawing.DrawLine(startPos + new Vector2(2, size.Y / 6), startPos + new Vector2(size.X, size.Y / 6),
                             new Color(r, g, b, 255));
            var text     = "Item Panel";
            var textSize = Drawing.MeasureText(text, "Arial",
                                               new Vector2((float)(size.Y / 6 * .80), (float)(size.Y / 6 * .95)), FontFlags.AntiAlias);
            var textPos = startPos;

            Drawing.DrawText(
                text,
                textPos + new Vector2(2, 2),
                new Vector2(textSize.Y, 0),
                Color.White,
                FontFlags.AntiAlias | FontFlags.StrikeOut);
            DrawItems(startPos + new Vector2(2, size.Y / 6 + 2), size, r, g, b);
            if (Members.Menu.Item("itempanel.Button.Enable").GetValue <bool>())
            {
                var buttonStartPos = startPos + new Vector2(size.X - size.Y / 6, 2);
                var buttonSize     = new Vector2(size.Y / 6 - 0, size.Y / 6 - 3);
                text = "S";
                Drawing.DrawRect(buttonStartPos, buttonSize, new Color(r, g, b, 255), true);
                textSize = Drawing.MeasureText(text, "Arial",
                                               new Vector2((float)(buttonSize.X), (float)(buttonSize.Y)), FontFlags.AntiAlias);

                if (Utils.IsUnderRectangle(Game.MouseScreenPosition, buttonStartPos.X, buttonStartPos.Y, buttonSize.X,
                                           buttonSize.Y))
                {
                    Drawing.DrawRect(buttonStartPos, buttonSize, new Color(0, 0, 0, 200));
                    if (Members.IsClicked && Utils.SleepCheck("cd_click"))
                    {
                        Utils.Sleep(250, "cd_click");
                        Members.Menu.Item("itempanel.Stash.Enable")
                        .SetValue(!Members.Menu.Item("itempanel.Stash.Enable").GetValue <bool>());
                    }
                }
                Drawing.DrawText(
                    text,
                    buttonStartPos + new Vector2(buttonSize.X / 3, buttonSize.Y / 5),
                    textSize,
                    Color.White,
                    FontFlags.AntiAlias | FontFlags.StrikeOut);
            }
            if (Members.Menu.Item("itempanel.Stash.Enable").GetValue <bool>())
            {
                text = "Stash Panel";
                var startPos2 = startPos + new Vector2(size.X, 0);
                Drawing.DrawRect(startPos2, size + new Vector2(2, 0), new Color(0, 0, 0, 100));
                textSize = Drawing.MeasureText(text, "Arial",
                                               new Vector2((float)(size.Y / 6 * .80), (float)(size.Y / 6 * .95)), FontFlags.AntiAlias);
                Drawing.DrawText(
                    text,
                    startPos2 + new Vector2(5, 2),
                    new Vector2(textSize.Y, 0),
                    Color.White,
                    FontFlags.AntiAlias | FontFlags.StrikeOut);
                Drawing.DrawRect(startPos2, size + new Vector2(2, 0), new Color(r, g, b, 255), true);
                Drawing.DrawLine(startPos2 + new Vector2(2, size.Y / 6), startPos2 + new Vector2(size.X, size.Y / 6),
                                 new Color(r, g, b, 255));
                DrawStashItems(startPos2 + new Vector2(2, size.Y / 6 + 2), size, r, g, b);
            }
        }
Beispiel #5
0
        public static void OnDraw(EventArgs args)
        {
            if (!Checker.IsActive())
            {
                return;
            }
            if (!Members.Menu.Item("itempanel.new.Enable").GetValue <bool>())
            {
                return;
            }
            var startPos = new Vector2(Members.Menu.Item("itempanel.X").GetValue <Slider>().Value,
                                       Members.Menu.Item("itempanel.Y").GetValue <Slider>().Value);
            var size = new Vector2(Members.Menu.Item("itempanel.SizeX").GetValue <Slider>().Value,
                                   Members.Menu.Item("itempanel.SizeY").GetValue <Slider>().Value);
            var mPos = Game.MouseScreenPosition;

            if (Utils.IsUnderRectangle(Game.MouseScreenPosition, startPos.X, startPos.Y, size.X, size.Y))
            {
                if (Members.IsClicked)
                {
                    if (!Sleeper.Sleeping)
                    {
                        _globalDif = mPos - startPos;
                        Sleeper.Sleep(500);
                    }
                    startPos = mPos - _globalDif;
                    Members.Menu.Item("itempanel.X").SetValue(new Slider((int)startPos.X, 0, 2000));
                    Members.Menu.Item("itempanel.Y").SetValue(new Slider((int)startPos.Y, 0, 2000));
                }
            }
            var r = Members.Menu.Item("itempanel.Red").GetValue <Slider>().Value;
            var g = Members.Menu.Item("itempanel.Green").GetValue <Slider>().Value;
            var b = Members.Menu.Item("itempanel.Blue").GetValue <Slider>().Value;

            if (Members.Menu.Item("itempanel.Stash.Enable").GetValue <bool>())
            {
                if (Utils.IsUnderRectangle(Game.MouseScreenPosition, startPos.X + size.X, startPos.Y, size.X, size.Y))
                {
                    if (Members.IsClicked && !Toggler.Sleeping)
                    {
                        Toggler.Sleep(250);

                        Members.Menu.Item("itempanel.Stash.Enable")
                        .SetValue(!Members.Menu.Item("itempanel.Stash.Enable").GetValue <bool>());
                    }
                }
            }
            else if (Members.Menu.Item("itempanel.Button.Enable").GetValue <bool>())
            {
                var togglePos  = new Vector2(startPos.X + size.X, startPos.Y);
                var toggleSize = new Vector2(10, size.Y);
                Drawing.DrawRect(togglePos, toggleSize, new Color(r, g, b), true);
                if (Utils.IsUnderRectangle(Game.MouseScreenPosition, togglePos.X, togglePos.Y, toggleSize.X, toggleSize.Y))
                {
                    if (Members.IsClicked && !Toggler.Sleeping)
                    {
                        Toggler.Sleep(250);

                        Members.Menu.Item("itempanel.Stash.Enable")
                        .SetValue(!Members.Menu.Item("itempanel.Stash.Enable").GetValue <bool>());
                    }
                    Drawing.DrawRect(togglePos + 1, toggleSize - 2, new Color(0, 155, 0, 100));
                }
            }

            Drawing.DrawRect(startPos, size + new Vector2(2, 0), new Color(0, 0, 0, 100));


            Drawing.DrawRect(startPos, size + new Vector2(1, 5), new Color(0, 0, 0, 50));
            Drawing.DrawRect(startPos - new Vector2(1), size + new Vector2(3, 5), new Color(r, g, b), true);


            var i = 0;

            if (Members.ItemDictionary.Count == 0)
            {
                return;
            }
            var stageSize = new Vector2(size.X / 6f, size.Y / 5f);
            var itemSize  = new Vector2(stageSize.X * 70 / 100f, stageSize.Y);

            foreach (var v in Members.EnemyHeroes.Where(v => !Members.MeepoIgnoreList.Contains(v)))
            {
                var items       = Manager.HeroManager.GetItemList(v);
                var heroIconPos = startPos + new Vector2(2) + new Vector2(0, stageSize.Y * i++);
                Drawing.DrawRect(heroIconPos, stageSize, Textures.GetHeroTexture(v.StoredName()));
                Drawing.DrawRect(heroIconPos, stageSize, new Color(r, g, b), true);
                if (!items.Any())
                {
                    continue;
                }
                for (int j = 0; j < 7; j++)
                {
                    var  itemTexture = Textures.GetTexture("materials/ensage_ui/items/emptyitembg.vmat");
                    Item item        = null;
                    if (j < items.Count)
                    {
                        item = items[j];
                        var curItem = item;
                        try
                        {
                            itemTexture = Textures.GetItemTexture(curItem.StoredName());
                            if (item is Bottle)
                            {
                                var bottletype = item as Bottle;
                                if (bottletype.StoredRune != RuneType.None)
                                {
                                    itemTexture =
                                        Textures.GetTexture(
                                            $"materials/ensage_ui/items/{item.Name.Replace("item_", "") + "_" + bottletype.StoredRune}.vmat");
                                }
                            }
                        }
                        catch
                        {
                            //Printer.PrintError($"[ItemPanel]: {v.Name}/ count: {j}/ {item?.Name}");
                        }
                    }
                    var curPos = heroIconPos + new Vector2(stageSize.X + 2, 0) + new Vector2(j * stageSize.X * 70 / 100f, 0);
                    Drawing.DrawRect(curPos, stageSize, itemTexture);
                    Drawing.DrawRect(curPos, itemSize, new Color(r, g, b), true);
                    if (item != null)
                    {
                        DrawState(item, v, curPos, itemSize);
                    }
                    if (Members.Menu.Item("itempanel.Stash.Enable").GetValue <bool>())
                    {
                        List <Item> stashItems;
                        try
                        {
                            if (!Members.StashItemDictionary.TryGetValue(v.Handle, out stashItems))
                            {
                                continue;
                            }
                        }
                        catch (Exception)
                        {
                            continue;
                        }
                        itemTexture = Textures.GetTexture("materials/ensage_ui/items/emptyitembg.vmat");
                        var k = j + 7;
                        if (j < stashItems.Count)
                        {
                            item = stashItems[j];
                            var curItem = item;
                            try
                            {
                                itemTexture = Textures.GetItemTexture(curItem.StoredName());
                                if (item is Bottle)
                                {
                                    var bottletype = item as Bottle;
                                    if (bottletype.StoredRune != RuneType.None)
                                    {
                                        itemTexture =
                                            Textures.GetTexture(
                                                $"materials/ensage_ui/items/{item.Name.Replace("item_", "") + "_" + bottletype.StoredRune}.vmat");
                                    }
                                }
                            }
                            catch
                            {
                                Printer.PrintError($"[ItemPanel]: {v.Name}/ count: {j}/ {item?.Name}");
                            }
                        }
                        curPos = heroIconPos + new Vector2(stageSize.X + 10, 0) + new Vector2(k * stageSize.X * 70 / 100f, 0);
                        Drawing.DrawRect(curPos, stageSize, itemTexture);
                        Drawing.DrawRect(curPos, itemSize, new Color(r, g, b), true);
                    }
                }
            }
        }
Beispiel #6
0
            public static void Update(EventArgs args)
            {
                if (!Checker.IsActive())
                {
                    return;
                }
                if (!HeroUpdate.Sleeping)
                {
                    HeroUpdate.Sleep(2000);
                    if (Members.Heroes.Count < 10)
                    {
                        Members.Heroes      = Heroes.All.Where(x => x != null && x.IsValid && !x.IsIllusion).ToList();
                        Members.AllyHeroes  = Members.Heroes.Where(x => x.Team == Members.MyHero.Team).ToList();
                        Members.EnemyHeroes =
                            Members.Heroes.Where(x => x.Team == Members.MyHero.GetEnemyTeam()).ToList();
                        //Printer.Print("STATUS:[all] " + Members.Heroes.Count+ " [enemy] " + Members.EnemyHeroes.Count + " [ally] " + Members.AllyHeroes.Count);
                        if (!Members.Apparition &&
                            Members.EnemyHeroes.Any(x => x.ClassID == ClassID.CDOTA_Unit_Hero_AncientApparition))
                        {
                            Members.Apparition = true;
                        }
                        if (Members.PAisHere == null &&
                            Members.EnemyHeroes.Any(x => x.ClassID == ClassID.CDOTA_Unit_Hero_PhantomAssassin))
                        {
                            Members.PAisHere = Members.EnemyHeroes.FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Unit_Hero_PhantomAssassin);
                        }
                        if (!Members.BaraIsHere &&
                            Members.EnemyHeroes.Any(x => x.ClassID == ClassID.CDOTA_Unit_Hero_SpiritBreaker))
                        {
                            Members.BaraIsHere = true;
                        }
                        if (Members.Mirana == null &&
                            Members.EnemyHeroes.Any(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Mirana))
                        {
                            Members.Mirana = Members.EnemyHeroes.FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Mirana);
                        }
                        if (Members.Windrunner == null &&
                            Members.EnemyHeroes.Any(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Windrunner))
                        {
                            Members.Windrunner = Members.EnemyHeroes.FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Windrunner);
                        }
                        if (Members.Invoker == null &&
                            Members.EnemyHeroes.Any(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Invoker))
                        {
                            Members.Invoker = Members.EnemyHeroes.FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Invoker);
                        }
                        if (Members.Kunkka == null &&
                            Members.EnemyHeroes.Any(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Kunkka))
                        {
                            Members.Kunkka = Members.EnemyHeroes.FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Kunkka);
                        }
                        if (Members.Lina == null &&
                            Members.EnemyHeroes.Any(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Lina))
                        {
                            Members.Lina = Members.EnemyHeroes.FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Lina);
                        }
                        if (Members.Leshrac == null &&
                            Members.EnemyHeroes.Any(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Leshrac))
                        {
                            Members.Leshrac = Members.EnemyHeroes.FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Leshrac);
                        }
                    }
                }

                if (!AbilityUpdate.Sleeping)
                {
                    AbilityUpdate.Sleep(1000);
                    foreach (var hero in /*Members.Heroes */ Manager.HeroManager.GetViableHeroes())
                    {
                        /*if ((hero.ClassID==ClassID.CDOTA_Unit_Hero_DoomBringer || hero.ClassID==ClassID.CDOTA_Unit_Hero_Rubick) && !hero.IsVisible)
                         *  continue;*/
                        try
                        {
                            if (!Members.AbilityDictionary.ContainsKey(hero.StoredName()))
                            {
                                Members.AbilityDictionary.Add(hero.StoredName(),
                                                              hero.Spellbook.Spells.Where(
                                                                  x =>
                                                                  x != null && x.IsValid && x.AbilityType != AbilityType.Attribute && x.AbilityType != AbilityType.Hidden &&
                                                                  x.AbilitySlot.ToString() != "-1")
                                                              .ToList());
                            }
                            if (
                                !Members.AbilityDictionary.ContainsValue(
                                    hero.Spellbook.Spells.Where(x => x.AbilitySlot.ToString() != "-1").ToList()))
                            {
                                Members.AbilityDictionary.Remove(hero.StoredName());
                                Members.AbilityDictionary.Add(hero.StoredName(), hero.Spellbook.Spells.Where(
                                                                  x =>
                                                                  x != null && x.IsValid && x.AbilityType != AbilityType.Attribute && x.AbilityType != AbilityType.Hidden &&
                                                                  x.AbilitySlot.ToString() != "-1")
                                                              .ToList());
                            }
                            if (!Members.ItemDictionary.ContainsValue(
                                    hero.Inventory.Items.Where(x => x != null && x.IsValid).ToList()))
                            {
                                Members.ItemDictionary.Remove(hero.StoredName());
                                Members.ItemDictionary.Add(hero.StoredName(),
                                                           hero.Inventory.Items.Where(x => x != null && x.IsValid).ToList());
                            }
                            if (Members.Menu.Item("itempanel.Stash.Enable").GetValue <bool>() &&
                                !Members.StashItemDictionary.ContainsValue(
                                    hero.Inventory.StashItems.Where(x => x != null && x.IsValid).ToList()))
                            {
                                Members.StashItemDictionary.Remove(hero.StoredName());
                                Members.StashItemDictionary.Add(hero.StoredName(),
                                                                hero.Inventory.StashItems.Where(x => x != null && x.IsValid).ToList());
                            }
                        }
                        catch (Exception)
                        {
                            Printer.Print("[UPDATER.ITEMS/ABILITY: ] " + hero.StoredName());
                        }
                    }
                }
            }
Beispiel #7
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 health    = v.Health;
                    var extraLife =
                        (uint)(Manager.HeroManager.GetItemList(v)
                               .Any(x => x.StoredName() == "item_infused_raindrop" && x.Cooldown <= 0)
                            ? 120
                            : 0);
                    if (extraLife > 100)
                    {
                        var needToCalcExtraLife =
                            InSys.Any(
                                x =>
                                x.DamageType == DamageType.Magical &&
                                AbilityDamage.CalculateDamage(x, Members.MyHero, v,
                                                              minusMagicResistancePerc: haveEb ? 40 : 0) > 120);
                        health += needToCalcExtraLife ? extraLife : 0;
                    }

                    var healthAfterShit = (int)(health - myDmg);
                    var size            = HUDInfo.GetHpBarSizeY();
                    var text            = $"{healthAfterShit} ({(int) 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()}");
                }
            }
        }
Beispiel #8
0
        private static void Drawing_OnEndScene(EventArgs args)
        {
            try
            {
                if (!Checker.IsActive())
                {
                    return;
                }
                if (!Members.Menu.Item("OpenDota.Enable").GetValue <bool>())
                {
                    return;
                }
            }
            catch (Exception)
            {
                // ignored
            }

            if (Drawing.Direct3DDevice9 == null || Drawing.Direct3DDevice9.IsDisposed)
            {
                return;
            }
            if (Check)
            {
                var newlist = PlayerInfoList.ToList();
                foreach (var playerInfo in newlist)
                {
                    var id             = playerInfo.Id;
                    var startXPosition = HeroPickStageScreenHelper.GetPlayerPosition(id);
                    var position       = new Vector2(startXPosition, 35);
                    var size           = HudInfoNew.GetTopPanelSizeY();
                    position += new Vector2(0, (float)size * 1.8f);
                    var defClr = Color.White;
                    DrawShadowText(playerInfo.Name, (int)position.X, (int)position.Y, defClr);
                    position.Y += 15;
                    DrawShadowText(playerInfo.Wr, (int)position.X, (int)position.Y, defClr);
                    position.Y += 15;
                    DrawShadowText(
                        playerInfo.Solo == 0 ? $"Estimated: {playerInfo.PossibleMmr}" : $"Solo: {playerInfo.Solo}",
                        (int)position.X, (int)position.Y, defClr);
                    if (playerInfo.Party > 0)
                    {
                        position.Y += 15;
                        DrawShadowText($"Party: {playerInfo.Party}", (int)position.X, (int)position.Y, defClr);
                    }
                    var gameHistorySize = playerInfo.Matches.Length - 2;
                    if (gameHistorySize >= 1)
                    {
                        position.Y += 15;
                        for (var i = 0; i < gameHistorySize; i++)
                        {
                            var isTrue = playerInfo.Matches[i + 1] == '+';
                            var clr    = isTrue ? Color.Green : Color.Red;
                            position.X += 10;
                            var text = '⬤';//●
                            DrawShadowText($"{text}", (int)position.X, (int)position.Y, clr);
                        }
                    }
                    if (playerInfo.Country.Length > 0)
                    {
                        try
                        {
                            var n = Convert.ToInt32(playerInfo.Country);
                            if (n > 0)
                            {
                                position.Y += 15;
                                DrawShadowText($"[{playerInfo.Country}]", (int)position.X, (int)position.Y, defClr);
                            }
                        }
                        catch (Exception)
                        {
                        }
                    }
                    if (playerInfo.TotalGames.Length > 0)
                    {
                        try
                        {
                            var n = Convert.ToInt32(playerInfo.TotalGames);
                            if (n == 0)
                            {
                                continue;
                            }
                        }
                        catch (Exception)
                        {
                            continue;
                        }
                        var totalGames = Convert.ToInt32(playerInfo.TotalGames);
                        var wins       = Convert.ToInt32(playerInfo.Wins);
                        var loses      = totalGames - wins;
                        var wr         = playerInfo.WrOnCurrentHero;
                        position.Y += 15;
                        position.X  = startXPosition;
                        DrawShadowText($"[{playerInfo.Hero?.GetRealName()}: {wins}/{loses} ({wr}%)]", (int)position.X, (int)position.Y, defClr);
                    }
                }
            }
        }
Beispiel #9
0
        private static void Drawing_OnDraw(EventArgs args)
        {
            if (!Checker.IsActive())
            {
                return;
            }
            if (!IsEnable)
            {
                return;
            }
            List <Hero> selectedHeroes = null;

            switch (SelectedIndex)
            {
            case 0:
                selectedHeroes = Manager.HeroManager.GetViableHeroes();
                break;

            case 1:
                selectedHeroes = Manager.HeroManager.GetAllyViableHeroes();
                break;

            case 2:
                selectedHeroes = Manager.HeroManager.GetEnemyViableHeroes();
                break;
            }
            if (selectedHeroes == null)
            {
                return;
            }
            foreach (var v in selectedHeroes)
            {
                try
                {
                    var pos = HUDInfo.GetHPbarPosition(v);
                    if (pos.IsZero)
                    {
                        continue;
                    }
                    var spells = Manager.HeroManager.GetAbilityList(v);
                    pos += new Vector2(0, HUDInfo.GetHPBarSizeX());
                    pos += new Vector2(ExtraX, ExtraY);
                    var counter = 0;
                    var size    = new Vector2(IconSize, IconSize);
                    foreach (var ability in spells)
                    {
                        var itemPos = pos + new Vector2(-2 + size.X * counter, 2);
                        Drawing.DrawRect(itemPos, size,
                                         Textures.GetSpellTexture(ability.StoredName()));
                        Drawing.DrawRect(itemPos, size,
                                         Color.Black, true);
                        var abilityState = ability.AbilityState;
                        if (abilityState == AbilityState.NotEnoughMana)
                        {
                            Drawing.DrawRect(itemPos, size,
                                             new Color(0, 0, 155, 155));
                            var neededMana = ((int)Math.Min(Math.Abs(v.Mana - ability.ManaCost), 99)).ToString(
                                CultureInfo.InvariantCulture);
                            var textSize = Drawing.MeasureText(neededMana, "Arial",
                                                               new Vector2(
                                                                   (float)(size.Y * TextSize),
                                                                   size.Y / 2), FontFlags.AntiAlias);
                            var textPos = itemPos + new Vector2(/*size.X-textSize.X*/ 1, 0);
                            Drawing.DrawRect(textPos - new Vector2(0, 0),
                                             new Vector2(textSize.X, textSize.Y),
                                             new Color(0, 0, 0, 200));
                            Drawing.DrawText(
                                neededMana,
                                textPos,
                                new Vector2(textSize.Y, 0),
                                Color.White,
                                FontFlags.AntiAlias | FontFlags.StrikeOut);
                        }
                        if (abilityState != AbilityState.NotLearned)
                        {
                            var level       = ability.Level;
                            var levelString = level.ToString();
                            var textSize    = Drawing.MeasureText(levelString, "Arial",
                                                                  new Vector2(
                                                                      (float)(size.Y * TextSizeLevel),
                                                                      size.Y / 2), FontFlags.AntiAlias);
                            var textPos = itemPos + new Vector2(1, size.Y - textSize.Y);
                            Drawing.DrawRect(textPos - new Vector2(0, 0),
                                             new Vector2(textSize.X, textSize.Y),
                                             new Color(0, 0, 0, 240));
                            Drawing.DrawText(
                                levelString,
                                textPos,
                                new Vector2(textSize.Y, 0),
                                Color.White,
                                FontFlags.AntiAlias | FontFlags.StrikeOut);
                        }
                        else
                        {
                            Drawing.DrawRect(itemPos, size,
                                             new Color(0, 0, 0, 150));
                        }
                        if (abilityState == AbilityState.OnCooldown)
                        {
                            var remTime  = ability.Cooldown;
                            var cooldown = Math.Min(remTime + 0.1, 99).ToString("0.0");
                            var textSize = Drawing.MeasureText(cooldown, "Arial",
                                                               new Vector2(
                                                                   (float)(size.Y * TextSize),
                                                                   size.Y / 2), FontFlags.AntiAlias);
                            var textPos = itemPos + new Vector2(0, 0);
                            Drawing.DrawRect(textPos - new Vector2(1, 0),
                                             new Vector2(textSize.X, textSize.Y),
                                             new Color(0, 0, 0, 200));
                            Drawing.DrawText(
                                cooldown,
                                textPos,
                                new Vector2(textSize.Y, 0),
                                Color.White,
                                FontFlags.AntiAlias | FontFlags.StrikeOut);
                        }


                        counter++;
                    }
                }
                catch (Exception e)
                {
                    Printer.Print($"[AbilityOverlay]: {v.StoredName()} : {e.HelpLink}");
                }
            }
        }
Beispiel #10
0
            public static void Update(EventArgs args)
            {
                if (!Checker.IsActive())
                {
                    return;
                }
                if (!HeroUpdate.Sleeping)
                {
                    /*foreach (var enemyHero in Members.EnemyHeroes)
                     * {
                     *  var worth = enemyHero.Inventory.Items.Aggregate<Item, long>(0, (current, item) => current + item.Cost);
                     *  Printer.Print(enemyHero.Name + " --> " + worth);
                     * }*/
                    HeroUpdate.Sleep(2000);
                    if (Members.Heroes.Count < 10)
                    {
                        Members.Heroes =
                            Heroes.All.Where(
                                x =>
                                x != null && x.IsValid && !x.IsIllusion && !IgnoreList.Contains(x.StoredName())).ToList();
                        Members.AllyHeroes  = Members.Heroes.Where(x => x.Team == Members.MyHero.Team).ToList();
                        Members.EnemyHeroes =
                            Members.Heroes.Where(x => x.Team == Members.MyHero.GetEnemyTeam()).ToList();

                        //Printer.Print("STATUS:[all] " + Members.Heroes.Count+ " [enemy] " + Members.EnemyHeroes.Count + " [ally] " + Members.AllyHeroes.Count);
                        if (!Members.Apparition &&
                            Members.EnemyHeroes.Any(x => x.ClassID == ClassID.CDOTA_Unit_Hero_AncientApparition))
                        {
                            Members.Apparition = true;
                        }
                        if (Members.PAisHere == null &&
                            Members.EnemyHeroes.Any(x => x.ClassID == ClassID.CDOTA_Unit_Hero_PhantomAssassin))
                        {
                            Members.PAisHere = Members.EnemyHeroes.FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Unit_Hero_PhantomAssassin);
                        }
                        if (!Members.BaraIsHere &&
                            Members.EnemyHeroes.Any(x => x.ClassID == ClassID.CDOTA_Unit_Hero_SpiritBreaker))
                        {
                            Members.BaraIsHere = true;
                        }
                        if (Members.Mirana == null &&
                            Members.EnemyHeroes.Any(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Mirana))
                        {
                            Members.Mirana = Members.EnemyHeroes.FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Mirana);
                        }
                        if (Members.Windrunner == null &&
                            Members.EnemyHeroes.Any(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Windrunner))
                        {
                            Members.Windrunner = Members.EnemyHeroes.FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Windrunner);
                        }
                        if (Members.Invoker == null &&
                            Members.EnemyHeroes.Any(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Invoker))
                        {
                            Members.Invoker = Members.EnemyHeroes.FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Invoker);
                        }
                        if (Members.Kunkka == null &&
                            Members.EnemyHeroes.Any(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Kunkka))
                        {
                            Members.Kunkka = Members.EnemyHeroes.FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Kunkka);
                        }
                        if (Members.Lina == null &&
                            Members.EnemyHeroes.Any(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Lina))
                        {
                            Members.Lina = Members.EnemyHeroes.FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Lina);
                        }
                        if (Members.Leshrac == null &&
                            Members.EnemyHeroes.Any(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Leshrac))
                        {
                            Members.Leshrac = Members.EnemyHeroes.FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Unit_Hero_Leshrac);
                        }
                    }
                }
                if (!UpdatePrediction.Sleeping /*&& Members.Menu.Item("lastPosition.Enable.Prediction").GetValue<bool>()*/)
                {
                    UpdatePrediction.Sleep(1);
                    var time = Game.GameTime;
                    foreach (var v in Members.EnemyHeroes.Where(x => x.IsAlive))
                    {
                        if (v.IsVisible)
                        {
                            if (Members.PredictionTimes.ContainsKey(v.StoredName()))
                            {
                                Members.PredictionTimes.Remove(v.StoredName());
                            }
                        }
                        else
                        {
                            float test;
                            if (!Members.PredictionTimes.TryGetValue(v.StoredName(), out test))
                            {
                                Members.PredictionTimes.Add(v.StoredName(), time);
                            }

                            /*else
                             * {
                             *  Members.PredictionTimes[v.StoredName()] = time;
                             * }*/
                        }
                    }
                }
                if (!AbilityUpdate.Sleeping)
                {
                    AbilityUpdate.Sleep(1000);
                    foreach (var hero in /*Members.Heroes */ Manager.HeroManager.GetViableHeroes())
                    {
                        /*if ((hero.ClassID==ClassID.CDOTA_Unit_Hero_DoomBringer || hero.ClassID==ClassID.CDOTA_Unit_Hero_Rubick) && !hero.IsVisible)
                         *  continue;*/
                        try
                        {
                            if (!Members.AbilityDictionary.ContainsKey(hero.StoredName()))
                            {
                                Members.AbilityDictionary.Add(hero.StoredName(),
                                                              hero.Spellbook.Spells.Where(
                                                                  x =>
                                                                  x != null && x.IsValid && x.AbilityType != AbilityType.Attribute && x.AbilityType != AbilityType.Hidden &&
                                                                  x.AbilitySlot.ToString() != "-1")
                                                              .ToList());
                            }
                            if (
                                !Members.AbilityDictionary.ContainsValue(
                                    hero.Spellbook.Spells.Where(x => x.AbilitySlot.ToString() != "-1").ToList()))
                            {
                                Members.AbilityDictionary.Remove(hero.StoredName());
                                Members.AbilityDictionary.Add(hero.StoredName(), hero.Spellbook.Spells.Where(
                                                                  x =>
                                                                  x.IsValid && x.AbilityType != AbilityType.Attribute && x.AbilityType != AbilityType.Hidden &&
                                                                  x.AbilitySlot.ToString() != "-1")
                                                              .ToList());
                            }
                            long worth = 0;
                            Members.NetWorthDictionary.Remove(hero.StoredName());
                            if (!Members.ItemDictionary.ContainsValue(
                                    hero.Inventory.Items.Where(x => x.IsValid).ToList()))
                            {
                                var items = hero.Inventory.Items.ToList();
                                Members.ItemDictionary.Remove(hero.StoredName());
                                Members.ItemDictionary.Add(hero.StoredName(),
                                                           items.Where(x => x.IsValid).ToList());
                                worth += items.Aggregate <Item, long>(0, (current, item) => current + item.Cost);
                            }
                            if ((Members.Menu.Item("itempanel.Stash.Enable").GetValue <bool>() || Members.Menu.Item("netWorth.Enable").GetValue <bool>()) &&
                                !Members.StashItemDictionary.ContainsValue(
                                    hero.Inventory.StashItems.Where(x => x.IsValid).ToList()))
                            {
                                var items = hero.Inventory.StashItems.ToList();
                                Members.StashItemDictionary.Remove(hero.StoredName());
                                Members.StashItemDictionary.Add(hero.StoredName(),
                                                                items.Where(x => x.IsValid).ToList());
                                worth += items.Aggregate <Item, long>(0, (current, item) => current + item.Cost);
                            }
                            Members.NetWorthDictionary.Add(hero.StoredName(), worth);
                        }
                        catch (Exception)
                        {
                            Printer.Print("[UPDATER.ITEMS/ABILITY: ] " + hero.StoredName());
                        }
                    }
                }
            }
Beispiel #11
0
 public static void Draw(EventArgs args)
 {
     if (!Checker.IsActive())
     {
         return;
     }
     if (!Members.Menu.Item("showmemore.Enable").GetValue <bool>())
     {
         return;
     }
     if (AAunit != null && AAunit.IsValid)
     {
         var aapos = Drawing.WorldToScreen(AAunit.Position);
         if (aapos.X > 0 && aapos.Y > 0)
         {
             Drawing.DrawLine(Drawing.WorldToScreen(Members.MyHero.Position), aapos, Color.AliceBlue);
             const string name = "materials/ensage_ui/spellicons/ancient_apparition_ice_blast.vmat";
             Drawing.DrawRect(aapos, new Vector2(50, 50), Drawing.GetTexture(name));
         }
     }
     if (Members.Menu.Item("scan.Enable").GetValue <bool>())
     {
         if (Members.ScanEnemy != null && Members.ScanEnemy.IsValid)
         {
             var position = Members.ScanEnemy.Position;
             var w2S      = Drawing.WorldToScreen(position);
             if (!w2S.IsZero)
             {
                 Drawing.DrawText(
                     "Scan Ability " + Members.ScanEnemy.FindModifier("modifier_radar_thinker").RemainingTime.ToString("F1"), w2S,
                     new Vector2(15, 15),
                     Color.White,
                     FontFlags.AntiAlias | FontFlags.StrikeOut);
             }
         }
     }
     if (Members.BaraIsHere)
     {
         foreach (var v in Manager.HeroManager.GetAllyViableHeroes())
         {
             var mod = v.HasModifier("modifier_spirit_breaker_charge_of_darkness_vision");
             if (mod)
             {
                 if (Equals(Members.MyHero, v))
                 {
                     Drawing.DrawRect(new Vector2(0, 0), new Vector2(Drawing.Width, Drawing.Height),
                                      new Color(Members.Menu.Item("charge" + ".Red").GetValue <Slider>().Value,
                                                Members.Menu.Item("charge" + ".Green").GetValue <Slider>().Value,
                                                Members.Menu.Item("charge" + ".Blue").GetValue <Slider>().Value,
                                                Members.Menu.Item("charge" + ".Alpha").GetValue <Slider>().Value));
                 }
                 if (!InSys.Contains(v))
                 {
                     Helper.GenerateSideMessage(v.Name.Replace("npc_dota_hero_", ""),
                                                "spirit_breaker_charge_of_darkness");
                     InSys.Add(v);
                 }
             }
             else
             {
                 if (InSys.Contains(v))
                 {
                     InSys.Remove(v);
                 }
             }
         }
     }
     if (Members.PAisHere != null)
     {
         var mod = Members.PAisHere.HasModifier("modifier_phantom_assassin_blur_active");
         if (mod && Members.PAisHere.StoredName() == "npc_dota_hero_phantom_assassin")
         {
             var size3 = new Vector2(10, 20) + new Vector2(13, -6);
             var w2M   = Helper.WorldToMinimap(Members.PAisHere.NetworkPosition);
             var name  = "materials/ensage_ui/miniheroes/" +
                         Members.PAisHere.StoredName().Replace("npc_dota_hero_", "") + ".vmat";
             Drawing.DrawRect(w2M - new Vector2(size3.X / 2, size3.Y / 2), size3,
                              Drawing.GetTexture(name));
         }
     }
 }
Beispiel #12
0
        private static async void GameOnOnUpdate(EventArgs args)
        {
            try
            {
                if (!Checker.IsActive())
                {
                    return;
                }
                if (!Members.Menu.Item("odp.Enable").GetValue <bool>())
                {
                    return;
                }
            }
            catch (Exception)
            {
                // ignored
            }
            if (_loaded)
            {
                return;
            }
            if (Check)
            {
                _loaded = true;
                Printer.PrintInfo("[OpenDota] Loaded");
                for (uint i = 0; i < Game.MaximumClients; i++)
                {
                    var player = ObjectManager.GetPlayerById(i);
                    if (player == null || !player.IsValid || player.IsFakeClient)
                    {
                        continue;
                    }
                    try
                    {
                        Printer.PrintSuccess(new string('-', Console.BufferWidth));
                        var steamId = player.PlayerSteamId;
                        Log.Debug($"Player({i}): {player.Name} => id: {steamId}");
                        if (steamId <= 10)
                        {
                            Log.Error("Wrong steam id!");
                            continue;
                        }
                        var test = await FindWinRateAsync(steamId);

                        if (test < 0 || test > 100)
                        {
                            Log.Error("Cant load this player!");
                            continue;
                        }
                        var playerReq = await GetPlayerAsync(steamId);

                        var wr = await FindFullWinRateAsync(steamId);

                        //var accName = GetValue("personaname\":", playerReq);
                        int    estimate    = 0;
                        int    stdDev      = 0;
                        int    solo        = 0;
                        int    party       = 0;
                        string country     = "";
                        string possibleMmr = "";
                        string matches     = "";

                        /*int estimate = Convert.ToInt32(GetValue("estimate\":", playerReq));
                         * int stdDev = Convert.ToInt32(GetValue("stdDev\":", playerReq));
                         * int solo = Convert.ToInt32(GetValue("solo_competitive_rank\":", playerReq));
                         * int party = Convert.ToInt32(GetValue("competitive_rank\":", playerReq));
                         * var country = GetValue("loccountrycode\":", playerReq);
                         * var possibleMmr = $"{estimate - stdDev}-{estimate + stdDev}";*/
                        try
                        {
                            //Console.WriteLine("estimate: "+ GetValue("estimate\":", playerReq));
                            estimate = Convert.ToInt32(GetValue("{\"estimate\":", playerReq));
                        }
                        catch (Exception)
                        {
                            //Log.Error("1");
                        }
                        try
                        {
                            var item = GetValue("stdDev\":", playerReq);
                            item   = item.Substring(0, item.IndexOf(".", StringComparison.Ordinal));
                            stdDev = Convert.ToInt32(item);
                        }
                        catch (Exception)
                        {
                            //Log.Error("2");
                        }
                        try
                        {
                            var item = GetValue("solo_competitive_rank\":", playerReq);
                            solo = Convert.ToInt32(item /*.Substring(1, item.Length - 2)*/);
                        }
                        catch (Exception)
                        {
                            //Log.Error("3");
                        }
                        try
                        {
                            var item = GetValue("\"competitive_rank\":", playerReq);
                            party = Convert.ToInt32(item /*.Substring(1, item.Length - 2)*/);
                        }
                        catch (Exception)
                        {
                            //Log.Error("4");
                        }
                        try
                        {
                            country = GetValue("loccountrycode\":", playerReq);
                        }
                        catch (Exception)
                        {
                            //Log.Error("5");
                        }
                        try
                        {
                            possibleMmr = $"{estimate - stdDev}-{estimate + stdDev}";
                        }
                        catch (Exception)
                        {
                            //Log.Error("6");
                        }
                        try
                        {
                            matches = await FindMatches(steamId);
                        }
                        catch (Exception)
                        {
                            //Log.Error("7");
                        }
                        //Log.Debug("test: "+ matches);
                        PlayerInfoList.Add(new PlayerInfo((int)i, solo, party, country, possibleMmr, wr, matches, player.Name));
                        Log.Debug(
                            $"[WinRate: {wr}] [solo: {solo}] [party {party}] [estimate mmr: {possibleMmr}] [{country}] history: {matches}");
                        //var success = await TryToFindPlayerAsync(player.Name);
                        //var success = TryToFindPlayer(player.Name);

                        /*Log.Debug($"Try To Find player with search API -> player({i}): " + player.Name + " -> (steamId)" +
                         *        player.PlayerSteamID +
                         *        $" -> success: {success.Length != 2} bufferSize [{success.Length}]");
                         *
                         * if (success.Length != 2)
                         * {
                         *  var accId = GetValue("account_id\":", success);
                         *  var accName = GetValue("personaname\":", success);
                         *  Log.Debug("id: " + accId);
                         *  Log.Debug("personaname: " + accName);
                         *  Log.Debug("wr: " + FindWinRate(Convert.ToUInt32(accId)) + "%");
                         *  //Log.Debug("GetPlayer: " + GetPlayer(accId));
                         * }
                         * else
                         * {
                         *  Log.Debug($"cant find {player.Name}!");
                         * }*/
                    }
                    catch (Exception e)
                    {
                        Log.Debug($"error with player: {player.Name} ({i}) -> {e}");
                    }
                }
            }
        }