Exemple #1
0
        private void OnNewHero(object sender, Hero hero)
        {
            DelayAction.Add(350, () =>
            {
                if (hero == null || !hero.IsValid)
                {
                    return;
                }
                if (hero.IsIllusion)
                {
                    return;
                }
                if (Heroes.Any(x => x.Hero.Equals(hero)))
                {
                    Log.Error($"Cant init New Hero -> {hero.GetDisplayName()} [{hero.Handle}]");
                    return;
                }

                if (hero.HeroId == HeroId.npc_dota_hero_monkey_king)
                {
                    if (!hero.Spellbook.Spells.Any())
                    {
                        Log.Error($"Monkey king bugisoft (ubishit) -> [{hero.Handle}]");
                        return;
                    }
                }

                var myTeam     = Main.Context.Value.Owner.Team;
                var targetTeam = hero.Team;
                var isAlly     = myTeam == targetTeam;

                var newHero = new HeroContainer(hero, isAlly, Main);
                if (hero.HeroId == HeroId.npc_dota_hero_phantom_assassin && !isAlly)
                {
                    Main.Config.ShowMeMore.InitPhantomAssiasin(newHero);
                }
                try
                {
                    Heroes.Add(newHero);

                    if (isAlly)
                    {
                        AllyHeroes.Add(newHero);
                    }
                    else
                    {
                        EnemyHeroes.Add(newHero);
                    }

                    Log.Info($"New Hero -> {hero.GetDisplayName()} [{hero.Handle}] [{(isAlly ? "Ally" : "Enemy")}]");
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            });
        }
Exemple #2
0
        private void OnNewHero(object sender, Hero hero)
        {
            DelayAction.Add(100, () =>
            {
                if (hero == null || !hero.IsValid)
                {
                    return;
                }
                if (hero.IsIllusion)
                {
                    return;
                }
                if (Heroes.Any(x => x.Hero.Equals(hero)))
                {
                    Log.Error($"Cant init New Hero -> {hero.GetDisplayName()} [{hero.Handle}]");
                    return;
                }
                if (hero.ClassId == ClassId.CDOTA_Unit_Hero_MonkeyKing)
                {
                    if (!hero.Spellbook.Spells.Any())
                    {
                        Log.Error($"Monkey king bugisoft (ubishit) -> [{hero.Handle}]");
                        return;
                    }
                }
                var myTeam     = Main.Context.Value.Owner.Team;
                var targetTeam = hero.Team;
                var isAlly     = myTeam == targetTeam;
                var newHero    = new HeroContainer(hero, isAlly, Main);
                try
                {
                    Heroes.Add(newHero);

                    if (isAlly)
                    {
                        AllyHeroes.Add(newHero);
                    }
                    else
                    {
                        EnemyHeroes.Add(newHero);
                    }

                    Log.Info($"New Hero -> {hero.GetDisplayName()} [{hero.Handle}] [{(isAlly ? "Ally" : "Enemy")}]");
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            });
        }