Пример #1
0
 // Token: 0x06000434 RID: 1076 RVA: 0x00017138 File Offset: 0x00015338
 private void OnAddTrackingProjectile(TrackingProjectileEventArgs args)
 {
     try
     {
         TrackingProjectile projectile   = args.Projectile;
         Entity             target       = projectile.Target;
         EntityHandle?      entityHandle = (target != null) ? new EntityHandle?(target.Handle) : null;
         if (!(((entityHandle != null) ? new uint?(entityHandle.GetValueOrDefault()) : null) != base.Owner.HeroHandle))
         {
             Unit unit = projectile.Source as Unit;
             if (!(unit == null))
             {
                 Unit9 unit2 = EntityManager9.GetUnit(unit.Handle);
                 if (!(unit2 == null))
                 {
                     this.projectiles[projectile] = unit2.GetAttackDamage(base.Owner, 2, 0f);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex, null);
     }
 }
Пример #2
0
        private void OnModifierAdded(Unit sender, ModifierChangedEventArgs args)
        {
            try
            {
                if (sender.Team == this.OwnerTeam)
                {
                    return;
                }

                if (args.Modifier.Name != "modifier_slark_dark_pact")
                {
                    return;
                }

                this.unit = EntityManager9.GetUnit(sender.Handle);
                if (this.unit == null)
                {
                    return;
                }

                this.effect = new ParticleEffect(
                    "particles/units/heroes/hero_slark/slark_dark_pact_start.vpcf",
                    sender,
                    ParticleAttachment.AbsOriginFollow);

                Unit.OnModifierRemoved += this.OnModifierRemoved;
                this.handler.IsEnabled  = true;
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Пример #3
0
        private void OnHandlePropertyChange(Entity sender, HandlePropertyChangeEventArgs args)
        {
            try
            {
                if (args.NewValue == args.OldValue || args.PropertyName != "m_hTowerAttackTarget")
                {
                    return;
                }

                var unit = EntityManager9.GetUnit(args.NewValue);
                if (unit == null || !unit.IsHero || unit.IsIllusion || unit.Distance(this.owner) > 1000)
                {
                    return;
                }

                this.effect?.Dispose();

                this.effect = new ParticleEffect(@"materials\ensage_ui\particles\target.vpcf", unit.Position);
                this.effect.SetControlPoint(2, sender.Position);
                this.effect.SetControlPoint(5, new Vector3(255, 0, 0));
                this.effect.SetControlPoint(6, new Vector3(255));

                this.tower             = (Tower)sender;
                this.towerTarget       = unit;
                this.handler.IsEnabled = true;
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Пример #4
0
        private void OnModifierAdded(ModifierAddedEventArgs e)
        {
            try
            {
                var modifier = e.Modifier;
                var sender   = modifier.Owner;
                if (sender.Team == this.OwnerTeam)
                {
                    return;
                }

                if (modifier.Name != "modifier_slark_dark_pact")
                {
                    return;
                }

                this.unit = EntityManager9.GetUnit(sender.Handle);
                if (this.unit == null)
                {
                    return;
                }

                this.effect = ParticleManager.CreateParticle(
                    "particles/units/heroes/hero_slark/slark_dark_pact_start.vpcf",
                    ParticleAttachment.AbsOriginFollow,
                    sender);

                ModifierManager.ModifierRemoved += this.OnModifierRemoved;
                this.handler.IsEnabled           = true;
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
Пример #5
0
        // Token: 0x06000316 RID: 790 RVA: 0x0001B808 File Offset: 0x00019A08
        public override void AddDrawableAbility(List <IDrawableAbility> drawableAbilities, ParticleEffect particle, Team allyTeam, INotificator notificator)
        {
            Unit9 unit = EntityManager9.GetUnit(particle.Owner.Handle);

            if (unit == null || unit.IsVisible)
            {
                return;
            }
            Vector3 v = base.RawParticlePosition ? particle.Position : particle.GetControlPoint(base.ControlPoint);

            if (v.Distance2D(unit.BaseUnit.Position, false) < 50f)
            {
                return;
            }
            string          name            = unit.Name;
            DrawableAbility drawableAbility = new DrawableAbility
            {
                AbilityTexture     = base.AbilityId + "_rounded",
                HeroTexture        = name + "_rounded",
                MinimapHeroTexture = name + "_icon",
                ShowUntil          = Game.RawGameTime + base.TimeToShow,
                Position           = v.SetZ(new float?((float)350))
            };

            if (base.Replace)
            {
                IDrawableAbility drawableAbility2 = drawableAbilities.LastOrDefault((IDrawableAbility x) => x.AbilityTexture == drawableAbility.AbilityTexture && x.HeroTexture == drawableAbility.HeroTexture);
                if (drawableAbility2 != null)
                {
                    drawableAbilities.Remove(drawableAbility2);
                }
            }
            drawableAbilities.Add(drawableAbility);
        }
Пример #6
0
        private void OnModifierAdded(ModifierAddedEventArgs e)
        {
            var modifier = e.Modifier;
            var sender   = modifier.Owner;

            try
            {
                if (sender.Team != this.owner.Team || modifier.IsHidden || !this.denyModifiers.Contains(modifier.Name))
                {
                    return;
                }

                var unit = EntityManager9.GetUnit(sender.Handle);
                if (unit == null || unit.IsMyHero || unit.IsIllusion || !unit.IsHero)
                {
                    return;
                }

                this.units[unit]       = null;
                this.handler.IsEnabled = true;
            }
            catch (Exception ex)
            {
                Logger.Error(ex, sender);
            }
        }
Пример #7
0
        private void OnBoolPropertyChange(Entity sender, BoolPropertyChangeEventArgs args)
        {
            try
            {
                if (args.OldValue == args.NewValue || (!args.OldValue && args.NewValue) || args.PropertyName != "m_bIsWaitingToSpawn")
                {
                    return;
                }

                if (this.spawnSleeper)
                {
                    return;
                }

                var unit = EntityManager9.GetUnit(sender.Handle);
                if (unit == null || !unit.IsLaneCreep || unit.Team != this.ownerTeam)
                {
                    return;
                }

                foreach (var creepWave in this.creepWaves.Where(x => !x.IsSpawned))
                {
                    creepWave.Spawn();
                }

                this.spawnSleeper.Sleep(25);
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Пример #8
0
 // Token: 0x06000111 RID: 273 RVA: 0x0000A8A4 File Offset: 0x00008AA4
 private void OnAbilityRemoved(Ability9 ability)
 {
     try
     {
         if (ability.IsItem)
         {
             Unit9 unit = ability.Owner;
             if (unit is SpiritBear)
             {
                 unit = EntityManager9.GetUnit(unit.Owner.Handle);
                 if (unit == null)
                 {
                     return;
                 }
             }
             if (this.units.ContainsKey(unit))
             {
                 Dictionary <Unit9, int> dictionary = this.units;
                 Unit9 key = unit;
                 dictionary[key] -= (int)ability.BaseItem.Cost;
             }
         }
     }
     catch (Exception exception)
     {
         Logger.Error(exception, null);
     }
 }
Пример #9
0
        public override bool IsIntersecting(Unit9 unit, bool checkPrediction)
        {
            var position = this.missileUnit.NetworkPosition;

            if (this.initialPosition == position)
            {
                return(false);
            }

            var missile = EntityManager9.GetUnit(this.missileUnit.Handle);

            if (missile == null)
            {
                return(false);
            }

            var target = EntityManager9.Units.Where(x => x.IsEnemy(this.Caster) && x.IsAlive && x.IsUnit)
                         .OrderBy(x => missile.GetAngle(x.Position))
                         .FirstOrDefault();

            if (target == null)
            {
                return(false);
            }

            return(unit.Equals(target));
        }
Пример #10
0
        public override void AddDrawableAbility(
            List <IDrawableAbility> drawableAbilities,
            ParticleEffect particle,
            Team allyTeam,
            INotificator notificator)
        {
            if (particle.GetControlPoint(1) == new Vector3(-1))
            {
                return;
            }

            var owner = this.SearchOwner || !(particle.Owner is Unit)
                            ? EntityManager9.Abilities.FirstOrDefault(x => x.Id == this.AbilityId && x.Owner.Team != allyTeam)?.Owner
                            : EntityManager9.GetUnit(particle.Owner.Handle);

            if (owner?.IsVisible != false)
            {
                return;
            }

            string ownerName;

            if (owner.IsHero)
            {
                ownerName = owner.Name;
            }
            else
            {
                ownerName = owner.Owner?.Name;

                if (ownerName == null)
                {
                    return;
                }
            }

            var drawableAbility = new DrawableAbility
            {
                AbilityTexture     = this.AbilityId + "_rounded",
                HeroTexture        = ownerName + "_rounded",
                MinimapHeroTexture = ownerName + "_icon",
                ShowUntil          = Game.RawGameTime + this.TimeToShow,
                Position           = (this.RawParticlePosition ? particle.Position : particle.GetControlPoint(this.ControlPoint)).SetZ(350)
            };

            owner.ChangeBasePosition(drawableAbility.Position);

            if (this.Replace)
            {
                var exist = drawableAbilities.LastOrDefault(
                    x => x.AbilityTexture == drawableAbility.AbilityTexture && x.HeroTexture == drawableAbility.HeroTexture);

                if (exist != null)
                {
                    drawableAbilities.Remove(exist);
                }
            }

            drawableAbilities.Add(drawableAbility);
        }
Пример #11
0
        private void OnModifierRemoved(ModifierRemovedEventArgs e)
        {
            var modifier = e.Modifier;
            var sender   = modifier.Owner;

            try
            {
                if (sender.Team != this.owner.Team || modifier.IsHidden || !this.denyModifiers.Contains(modifier.Name))
                {
                    return;
                }

                var unit = EntityManager9.GetUnit(sender.Handle);
                if (unit == null || !this.units.TryGetValue(unit, out var effect))
                {
                    return;
                }

                effect?.Dispose();
                this.units.Remove(unit);
            }
            catch (Exception ex)
            {
                Logger.Error(ex, sender);
            }
        }
Пример #12
0
        private void OnAddTrackingProjectile(TrackingProjectileAddedEventArgs args)
        {
            if (!this.Menu.AbilitySettings.IsCounterEnabled(this.Ability.Name))
            {
                return;
            }

            try
            {
                var projectile = args.TrackingProjectile;
                if (projectile.Target?.Handle != this.Owner.Handle)
                {
                    return;
                }

                var source = projectile.Source as Unit;
                if (source == null)
                {
                    return;
                }

                var unit = EntityManager9.GetUnit(source.Handle);
                if (unit == null)
                {
                    return;
                }

                this.projectiles[projectile] = unit.GetAttackDamage(this.Owner, DamageValue.Maximum);
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
        // Token: 0x060002E4 RID: 740 RVA: 0x0001ACFC File Offset: 0x00018EFC
        public override void AddDrawableAbility(List <IDrawableAbility> drawableAbilities, ParticleEffect particle, Team allyTeam, INotificator notificator)
        {
            Vector3 position = particle.GetControlPoint(base.ControlPoint);

            if (particle.Name.Contains("detonate"))
            {
                DrawableRemoteMinesAbility drawableRemoteMinesAbility = drawableAbilities.OfType <DrawableRemoteMinesAbility>().FirstOrDefault((DrawableRemoteMinesAbility x) => x.Position.Distance2D(position, false) < 10f);
                if (drawableRemoteMinesAbility != null)
                {
                    if (drawableRemoteMinesAbility.IsShowingRange)
                    {
                        drawableRemoteMinesAbility.RemoveRange();
                    }
                    drawableAbilities.Remove(drawableRemoteMinesAbility);
                    return;
                }
            }
            else
            {
                if (ObjectManager.GetEntitiesFast <Unit>().FirstOrDefault((Unit x) => x.Name == "npc_dota_techies_remote_mine" && x.Distance2D(position) < 10f) != null)
                {
                    return;
                }
                Unit9 owner = EntityManager9.GetUnit(particle.Owner.Handle);
                if (owner == null)
                {
                    return;
                }
                UpdateManager.BeginInvoke(delegate
                {
                    try
                    {
                        if (particle.IsValid)
                        {
                            DrawableRemoteMinesAbility drawableRemoteMinesAbility2 = new DrawableRemoteMinesAbility
                            {
                                AbilityTexture     = this.AbilityId + "_rounded",
                                HeroTexture        = owner.Name + "_rounded",
                                MinimapHeroTexture = owner.Name + "_icon",
                                Position           = position.SetZ(new float?((float)350)),
                                Duration           = this.Duration,
                                IsShowingRange     = this.ShowRange,
                                Range         = this.Range,
                                RangeColor    = this.RangeColor,
                                ShowUntil     = Game.RawGameTime + this.Duration,
                                ShowHeroUntil = Game.RawGameTime + this.TimeToShow,
                                Owner         = owner.BaseEntity
                            };
                            drawableRemoteMinesAbility2.DrawRange();
                            drawableAbilities.Add(drawableRemoteMinesAbility2);
                        }
                    }
                    catch (Exception exception)
                    {
                        Logger.Error(exception, null);
                    }
                }, 1000);
            }
        }
Пример #14
0
        private void CheckTeleport(ParticleEffect particle, bool start)
        {
            try
            {
                if (!particle.IsValid)
                {
                    return;
                }

                var colorCp = particle.GetControlPoint(2);
                var color   = Color.FromArgb(
                    (int)(255 * Math.Round(colorCp.X, 2)),
                    (int)(255 * Math.Round(colorCp.Y, 2)),
                    (int)(255 * Math.Round(colorCp.Z, 2)));

                if (!this.colors.TryGetValue(color, out var id))
                {
                    return;
                }

                var player = ObjectManager.GetPlayerById(id);
                if (player == null || player.Hero == null || player.Team == this.ownerTeam)
                {
                    return;
                }

                var hero = (Hero9)EntityManager9.GetUnit(player.Hero.Handle);
                if (hero == null || (hero.IsVisible && start))
                {
                    return;
                }

                var position = particle.GetControlPoint(0);
                var heroId   = hero.Id;
                var duration = 3f;

                //  if (hero.Abilities.Any(x => x.Id == AbilityId.item_travel_boots && x.CanBeCasted(false)))
                {
                    duration = this.GetDuration(heroId, position, start);
                }

                this.AddTeleport(new Teleport(particle, heroId, position, duration, start));

                if (start)
                {
                    hero.ChangeBasePosition(position);
                }
                else
                {
                    UpdateManager.BeginInvoke(() => this.SetPosition(particle, position, hero), (int)(duration * 1000) - 200);
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Пример #15
0
        private void OnAddTrackingProjectile(TrackingProjectileEventArgs args)
        {
            try
            {
                var projectile = args.Projectile;
                if (projectile.IsAutoAttackProjectile())
                {
                    return;
                }

                var target = EntityManager9.GetUnit(projectile.Target.Handle);
                if (target == null || target.Team != this.myTeam)
                {
                    return;
                }

                var source = args.Projectile.Source;
                if (source != null)
                {
                    //// enemy ability, but added though ally
                    //// might add some ability prediction problems...
                    //var thoughAlly = target.Team == this.myTeam && source.Team == this.myTeam;

                    //var ability = this.evadableAbilities.OfType<IProjectile>()
                    //    .FirstOrDefault(
                    //        x => (int)x.ActiveAbility.Speed == projectile.Speed && x.ActiveAbility.TimeSinceCasted < 1.5f
                    //             && (thoughAlly || x.ActiveAbility.Owner.Handle == source.Handle));

                    var ability = this.evadableAbilities
                                  .Where(
                        x => x.Ability.Owner.Handle == source.Handle &&
                        (x.Ability.TimeSinceCasted < 1.5f + (x.Ability is IChanneled channeled ? channeled.ChannelTime : 0) ||
                         x.Ability.BaseAbility.IsHidden))
                                  .OfType <IProjectile>()
                                  .FirstOrDefault(x => (int)x.ActiveAbility.Speed == projectile.Speed);

                    ability?.AddProjectile(projectile, target);
                    return;
                }

                var predictedAbilities = this.evadableAbilities.Where(
                    x => !x.Ability.Owner.IsVisible || x.Ability.TimeSinceCasted < 1.5f
                    /*+ x.AdditionalDelay*/)
                                         .OfType <IProjectile>()
                                         .Where(x => (int)x.ActiveAbility.Speed == projectile.Speed)
                                         .ToList();

                if (predictedAbilities.Count == 1)
                {
                    predictedAbilities[0].AddProjectile(projectile, target);
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
        // Token: 0x060002ED RID: 749 RVA: 0x0001AF90 File Offset: 0x00019190
        public override void AddDrawableAbility(List <IDrawableAbility> drawableAbilities, ParticleEffect particle, Team allyTeam, INotificator notificator)
        {
            if (particle.GetControlPoint(1u) == new Vector3(-1f))
            {
                return;
            }
            Unit9 unit;

            if (!base.SearchOwner && particle.Owner is Unit)
            {
                unit = EntityManager9.GetUnit(particle.Owner.Handle);
            }
            else
            {
                Ability9 ability = EntityManager9.Abilities.FirstOrDefault((Ability9 x) => x.Id == this.AbilityId && x.Owner.Team != allyTeam);
                unit = ((ability != null) ? ability.Owner : null);
            }
            Unit9 unit2 = unit;

            if (unit2 == null || unit2.IsVisible)
            {
                return;
            }
            string text;

            if (unit2.IsHero)
            {
                text = unit2.Name;
            }
            else
            {
                Unit9 owner = unit2.Owner;
                text = ((owner != null) ? owner.Name : null);
                if (text == null)
                {
                    return;
                }
            }
            DrawableAbility drawableAbility = new DrawableAbility
            {
                AbilityTexture     = base.AbilityId + "_rounded",
                HeroTexture        = text + "_rounded",
                MinimapHeroTexture = text + "_icon",
                ShowUntil          = Game.RawGameTime + base.TimeToShow,
                Position           = (base.RawParticlePosition ? particle.Position : particle.GetControlPoint(base.ControlPoint)).SetZ(new float?((float)350))
            };

            if (base.Replace)
            {
                IDrawableAbility drawableAbility2 = drawableAbilities.LastOrDefault((IDrawableAbility x) => x.AbilityTexture == drawableAbility.AbilityTexture && x.HeroTexture == drawableAbility.HeroTexture);
                if (drawableAbility2 != null)
                {
                    drawableAbilities.Remove(drawableAbility2);
                }
            }
            drawableAbilities.Add(drawableAbility);
        }
Пример #17
0
        public void AddModifierObstacle(Modifier modifier, Unit sender)
        {
            var modifierOwner = EntityManager9.GetUnit(sender.Handle);

            if (modifierOwner?.IsAlly(this.Owner) != true)
            {
                return;
            }

            this.AddModifier(modifier, modifierOwner);
        }
Пример #18
0
        public override void AddDrawableAbility(
            List <IDrawableAbility> drawableAbilities,
            ParticleEffect particle,
            Team allyTeam,
            INotificator notificator)
        {
            UpdateManager.BeginInvoke(
                () =>
            {
                try
                {
                    if (!particle.IsValid)
                    {
                        return;
                    }

                    var owner = EntityManager9.GetUnit(particle.Owner.Handle);
                    if (owner == null)
                    {
                        return;
                    }

                    var drawableAbility = new DrawableWispUnit(owner, particle);

                    if (this.Replace)
                    {
                        var exist = drawableAbilities.LastOrDefault(x => x is DrawableWispUnit);

                        if (exist != null)
                        {
                            drawableAbilities.Remove(exist);
                        }
                    }

                    UpdateManager.BeginInvoke(
                        async() =>
                    {
                        while (particle.IsValid)
                        {
                            owner.ChangeBasePosition(particle.Position);
                            await Task.Delay(300);
                        }
                    });

                    drawableAbilities.Add(drawableAbility);
                }
                catch (Exception e)
                {
                    Logger.Error(e);
                }
            },
                1000);
        }
Пример #19
0
        private void OnOrderAdding(OrderAddingEventArgs e)
        {
            try
            {
                if (!e.Process || e.IsCustom)
                {
                    return;
                }

                var order = e.Order;
                if (order.IsQueued)
                {
                    return;
                }

                if (order.Type == OrderType.AttackTarget)
                {
                    if (this.OrbAbility.Enabled || !this.OrbAbility.CanBeCasted() || this.Owner.ManaPercentage < this.settings.MpThreshold)
                    {
                        return;
                    }

                    this.target = EntityManager9.GetUnit(order.Target.Handle);
                    if (this.target?.IsHero != true || this.target.IsIllusion || !this.settings.IsHeroEnabled(this.target.Name))
                    {
                        return;
                    }

                    if (order.Units.All(x => x.Handle != this.OwnerHandle))
                    {
                        return;
                    }

                    if (!this.groupSettings.UseWhenInvisible && !this.Owner.CanUseAbilitiesInInvisibility && this.Owner.IsInvisible)
                    {
                        return;
                    }

                    e.Process = false;
                    this.autocastHandler.IsEnabled = true;
                }
                else if (this.autocastHandler.IsEnabled)
                {
                    this.autocastHandler.IsEnabled = false;
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
        // Token: 0x06000322 RID: 802 RVA: 0x0001BBC4 File Offset: 0x00019DC4
        public override void AddDrawableAbility(List <IDrawableAbility> drawableAbilities, ParticleEffect particle, Team allyTeam, INotificator notificator)
        {
            Unit9 unit;

            if (!base.SearchOwner && particle.Owner is Unit)
            {
                unit = EntityManager9.GetUnit(particle.Owner.Handle);
            }
            else
            {
                Ability9 ability = EntityManager9.Abilities.FirstOrDefault((Ability9 x) => x.Id == this.AbilityId && x.Owner.Team != allyTeam);
                unit = ((ability != null) ? ability.Owner : null);
            }
            Unit9 unit2 = unit;

            if (unit2 == null || unit2.IsVisible)
            {
                return;
            }
            if (Game.RawGameTime - unit2.LastVisibleTime >= 1f)
            {
                DrawableAbility item = new DrawableAbility
                {
                    AbilityTexture     = base.AbilityId + "_rounded",
                    HeroTexture        = unit2.Name + "_rounded",
                    MinimapHeroTexture = unit2.Name + "_icon",
                    ShowUntil          = Game.RawGameTime + base.TimeToShow,
                    Position           = particle.GetControlPoint(base.ControlPoint)
                };
                drawableAbilities.Add(item);
                return;
            }
            Ability9 ability2 = unit2.Abilities.FirstOrDefault((Ability9 x) => x.Id == this.AbilityId);

            if (ability2 == null)
            {
                return;
            }
            DrawableAbility item2 = new DrawableAbility
            {
                AbilityTexture     = base.AbilityId + "_rounded",
                HeroTexture        = unit2.Name + "_rounded",
                MinimapHeroTexture = unit2.Name + "_icon",
                ShowUntil          = Game.RawGameTime + base.TimeToShow,
                Position           = unit2.InFront(ability2.Range, 0f, true)
            };

            drawableAbilities.Add(item2);
        }
        // Token: 0x0600030D RID: 781 RVA: 0x0001B590 File Offset: 0x00019790
        public override void AddDrawableAbility(List <IDrawableAbility> drawableAbilities, ParticleEffect particle, Team allyTeam, INotificator notificator)
        {
            if (particle.Name.Contains("dash"))
            {
                drawableAbilities.RemoveAll((IDrawableAbility x) => x is DrawableFireRemnantAbility);
                return;
            }
            Unit9 unit = EntityManager9.GetUnit(particle.Owner.Owner.Handle);

            if (unit == null)
            {
                return;
            }
            Vector3 startPosition = particle.GetControlPoint(this.StartControlPoint);

            if (!unit.IsVisible)
            {
                DrawableAbility item = new DrawableAbility
                {
                    AbilityTexture     = base.AbilityId + "_rounded",
                    HeroTexture        = unit.Name + "_rounded",
                    MinimapHeroTexture = unit.Name + "_icon",
                    ShowUntil          = Game.RawGameTime + base.TimeToShow,
                    Position           = startPosition.SetZ(new float?((float)350))
                };
                drawableAbilities.Add(item);
            }
            DrawableFireRemnantAbility[] remnants = drawableAbilities.OfType <DrawableFireRemnantAbility>().ToArray <DrawableFireRemnantAbility>();
            Unit unit2 = ObjectManager.GetEntitiesFast <Unit>().Concat(ObjectManager.GetDormantEntities <Unit>()).FirstOrDefault((Unit x) => x.IsAlive && x.Name == "npc_dota_ember_spirit_remnant" && x.Distance2D(startPosition) < 1500f && remnants.All((DrawableFireRemnantAbility z) => z.Unit != x));

            if (unit2 == null)
            {
                return;
            }
            DrawableFireRemnantAbility item2 = new DrawableFireRemnantAbility
            {
                AbilityTexture     = base.AbilityId + "_rounded",
                HeroTexture        = unit.Name + "_rounded",
                MinimapHeroTexture = unit.Name + "_icon",
                Position           = particle.GetControlPoint(base.ControlPoint).SetZ(new float?((float)350)),
                Duration           = base.Duration,
                ShowUntil          = Game.RawGameTime + base.Duration,
                ShowHeroUntil      = Game.RawGameTime + base.TimeToShow,
                Owner = unit.BaseEntity,
                Unit  = unit2
            };

            drawableAbilities.Add(item2);
        }
Пример #22
0
        private void OnParticleAdded(Particle particle)
        {
            try
            {
                if (particle.Released || particle.Name != "particles/units/heroes/heroes_underlord/abbysal_underlord_darkrift_ambient.vpcf")
                {
                    return;
                }

                this.unit = EntityManager9.GetUnit(particle.Sender.Handle);
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Пример #23
0
        public override void AddDrawableAbility(
            List <IDrawableAbility> drawableAbilities,
            ParticleEffect particle,
            Team allyTeam,
            INotificator notificator)
        {
            var owner = EntityManager9.GetUnit(particle.Owner.Handle);

            if (owner?.IsVisible != false)
            {
                return;
            }

            var position = this.RawParticlePosition ? particle.Position : particle.GetControlPoint(this.ControlPoint);

            if (position.IsZero || position.Distance2D(owner.BaseUnit.Position) < 50)
            {
                return;
            }

            var ownerName = owner.Name;

            var drawableAbility = new DrawableAbility
            {
                AbilityTexture     = this.AbilityId + "_rounded",
                HeroTexture        = ownerName + "_rounded",
                MinimapHeroTexture = ownerName + "_icon",
                ShowUntil          = Game.RawGameTime + this.TimeToShow,
                Position           = position.SetZ(350)
            };

            owner.ChangeBasePosition(drawableAbility.Position);

            if (this.Replace)
            {
                var exist = drawableAbilities.LastOrDefault(
                    x => x.AbilityTexture == drawableAbility.AbilityTexture && x.HeroTexture == drawableAbility.HeroTexture);

                if (exist != null)
                {
                    drawableAbilities.Remove(exist);
                }
            }

            drawableAbilities.Add(drawableAbility);
        }
Пример #24
0
        private void OnExecuteOrder(Player sender, ExecuteOrderEventArgs args)
        {
            try
            {
                if (args.IsQueued || !args.IsPlayerInput || !args.Process)
                {
                    return;
                }

                if (args.OrderId == OrderId.AttackTarget)
                {
                    if (this.OrbAbility.Enabled || !this.OrbAbility.CanBeCasted() || this.Owner.ManaPercentage < this.settings.MpThreshold)
                    {
                        return;
                    }

                    this.target = EntityManager9.GetUnit(args.Target.Handle);
                    if (this.target?.IsHero != true || this.target.IsIllusion || !this.settings.IsHeroEnabled(this.target.Name))
                    {
                        return;
                    }

                    if (args.Entities.All(x => x.Handle != this.OwnerHandle))
                    {
                        return;
                    }

                    if (!this.groupSettings.UseWhenInvisible && !this.Owner.CanUseAbilitiesInInvisibility && this.Owner.IsInvisible)
                    {
                        return;
                    }

                    args.Process = false;
                    this.autocastHandler.IsEnabled = true;
                }
                else if (this.autocastHandler.IsEnabled)
                {
                    this.autocastHandler.IsEnabled = false;
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Пример #25
0
 // Token: 0x06000651 RID: 1617 RVA: 0x00021638 File Offset: 0x0001F838
 private void OnExecuteOrder(Player sender, ExecuteOrderEventArgs args)
 {
     try
     {
         if (args.OrderId == OrderId.AbilityTarget && args.Ability.Id == AbilityId.windrunner_focusfire && args.Process)
         {
             this.FocusFireTarget = EntityManager9.GetUnit(args.Target.Handle);
             if (!(this.FocusFireTarget == null) && !this.FocusFireTarget.IsLinkensProtected && !this.FocusFireTarget.IsSpellShieldProtected)
             {
                 Unit.OnModifierAdded += this.OnModifierAdded;
             }
         }
     }
     catch (Exception exception)
     {
         Logger.Error(exception, null);
     }
 }
Пример #26
0
        public void AddModifierObstacle(Modifier modifier, Unit sender)
        {
            var time = Game.RawGameTime - modifier.ElapsedTime;
            var unit = EntityManager9.GetUnit(sender.Handle);

            if (unit == null)
            {
                return;
            }

            var obstacle = new AreaOfEffectObstacle(this, unit.InFront(this.firesnapCookie.JumpRange))
            {
                EndCastTime     = time,
                EndObstacleTime = time + this.Ability.ActivationDelay,
            };

            this.Pathfinder.AddObstacle(obstacle);
        }
Пример #27
0
        // Token: 0x060003B1 RID: 945 RVA: 0x0001CDB8 File Offset: 0x0001AFB8
        private static void SetTarget(IEnumerable <Entity> entities, uint targetHandle)
        {
            Unit9 unit = EntityManager9.GetUnit(targetHandle);

            if (unit == null || !unit.IsAlive)
            {
                return;
            }
            foreach (Entity entity in entities)
            {
                Unit9 unitFast = EntityManager9.GetUnitFast(entity.Handle);
                if (unitFast != null && unitFast.IsEnemy(unit))
                {
                    unitFast.Target      = unit;
                    unitFast.IsAttacking = true;
                }
            }
        }
Пример #28
0
        private void OnNetworkPropertyChanged(Entity sender, NetworkPropertyChangedEventArgs e)
        {
            if (e.PropertyName != "m_bIsWaitingToSpawn")
            {
                return;
            }

            var newValue = e.NewValue.GetBoolean();
            var oldValue = e.OldValue.GetBoolean();

            if (newValue == oldValue || (!oldValue && newValue))
            {
                return;
            }

            UpdateManager.BeginInvoke(() =>
            {
                try
                {
                    if (this.spawnSleeper)
                    {
                        return;
                    }

                    var unit = EntityManager9.GetUnit(sender.Handle);
                    if (unit == null || !unit.IsLaneCreep || unit.Team != this.ownerTeam)
                    {
                        return;
                    }

                    foreach (var creepWave in this.creepWaves.Where(x => !x.IsSpawned))
                    {
                        creepWave.Spawn();
                    }

                    this.spawnSleeper.Sleep(25);
                }
                catch (Exception ex)
                {
                    Logger.Error(ex);
                }
            });
        }
Пример #29
0
 // Token: 0x06000085 RID: 133 RVA: 0x00006D9C File Offset: 0x00004F9C
 private void OnModifierRemoved(Unit sender, ModifierChangedEventArgs args)
 {
     try
     {
         Unit9 modifierOwner = EntityManager9.GetUnit(sender.Handle);
         if (!(modifierOwner == null) && modifierOwner.IsHero && !modifierOwner.IsMyHero && !modifierOwner.IsIllusion)
         {
             ModifierUnit modifierUnit = this.units.Find((ModifierUnit x) => x.Unit.Handle == modifierOwner.Handle);
             if (modifierUnit != null)
             {
                 modifierUnit.RemoveModifier(args.Modifier);
             }
         }
     }
     catch (Exception exception)
     {
         Logger.Error(exception, null);
     }
 }
Пример #30
0
        public virtual void AddDrawableAbility(List <IDrawableAbility> drawableAbilities, Unit unit, INotificator notificator)
        {
            var owner = unit.Owner;

            if (owner == null)
            {
                return;
            }

            var ownerName = owner.Name;
            var position  = unit.Position;

            var drawableAbility = new DrawableUnitAbility
            {
                AbilityTexture     = this.AbilityId + "_rounded",
                HeroTexture        = ownerName + "_rounded",
                MinimapHeroTexture = ownerName + "_icon",
                Position           = position.SetZ(Math.Min(position.Z, 350)),
                Unit           = unit,
                IsShowingRange = this.ShowRange,
                RangeColor     = this.RangeColor,
                Range          = this.Range,
                Duration       = this.Duration,
                ShowUntil      = Game.RawGameTime + this.Duration,
                ShowHeroUntil  = Game.RawGameTime + this.TimeToShow,
                ShowTimer      = this.ShowTimer,
                Owner          = owner,
            };

            if (this.AbilityId != AbilityId.zuus_cloud)
            {
                EntityManager9.GetUnit(unit.Handle)?.ChangeBasePosition(drawableAbility.Position);
            }

            drawableAbility.DrawRange();
            drawableAbilities.Add(drawableAbility);

            if (this.ShowNotification)
            {
                notificator?.PushNotification(new AbilityNotification(ownerName, this.AbilityId.ToString()));
            }
        }