Exemplo n.º 1
0
        private void OnExecuteOrder(Player sender, ExecuteOrderEventArgs args)
        {
            try
            {
                if (!args.Process || args.IsPlayerInput || args.OrderId != OrderId.AbilityLocation)
                {
                    return;
                }

                var ability = EntityManager9.GetAbility(args.Ability.Handle);
                if (ability == null)
                {
                    return;
                }

                if (this.IsIgnored(ability))
                {
                    return;
                }

                this.abilityPositions[ability.Handle] = args.TargetPosition;
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Exemplo n.º 2
0
        private void OnOrderAdding(OrderAddingEventArgs e)
        {
            try
            {
                if (!e.Process || !e.IsCustom)
                {
                    return;
                }

                var order = e.Order;
                if (order.Type != OrderType.CastPosition)
                {
                    return;
                }

                var ability = EntityManager9.GetAbility(order.Ability.Handle);
                if (ability == null)
                {
                    return;
                }

                if (this.IsIgnored(ability))
                {
                    return;
                }

                this.abilityPositions[ability.Handle] = order.Position;
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
Exemplo n.º 3
0
        private void OnBoolPropertyChange(Entity sender, BoolPropertyChangeEventArgs args)
        {
            try
            {
                if (args.NewValue == args.OldValue || args.PropertyName != "m_bInAbilityPhase")
                {
                    return;
                }

                var ability = EntityManager9.GetAbility(sender.Handle) as ActiveAbility;
                if (ability?.IsControllable != true)
                {
                    return;
                }

                if (this.IsIgnored(ability))
                {
                    return;
                }

                if (!(ability is AreaOfEffectAbility) && !(ability is PredictionAbility))
                {
                    return;
                }

                if (args.NewValue)
                {
                    if (ability is AreaOfEffectAbility)
                    {
                        if (ability.CastRange > 0)
                        {
                            UpdateManager.BeginInvoke(
                                () => this.abilityPositions[ability.Handle] = ability.Owner.InFront(ability.CastRange),
                                10);
                        }
                        else
                        {
                            UpdateManager.BeginInvoke(() => this.abilityPositions[ability.Handle] = ability.Owner.Position, 10);
                        }
                    }

                    this.abilityTimings[ability]   = Game.RawGameTime + ability.CastPoint;
                    this.failSafeHandler.IsEnabled = true;
                }
                else
                {
                    this.abilityTimings.Remove(ability);
                    this.abilityPositions.Remove(ability.Handle);
                    if (this.abilityTimings.Count <= 0)
                    {
                        this.failSafeHandler.IsEnabled = false;
                    }
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Exemplo n.º 4
0
 // Token: 0x060009F7 RID: 2551 RVA: 0x0002B518 File Offset: 0x00029718
 private void OnBoolPropertyChange(Entity sender, BoolPropertyChangeEventArgs args)
 {
     try
     {
         if (args.NewValue != args.OldValue && !(args.PropertyName != "m_bInAbilityPhase"))
         {
             ActiveAbility ability  = EntityManager9.GetAbility(sender.Handle) as ActiveAbility;
             ActiveAbility ability2 = ability;
             if (ability2 != null && ability2.IsControllable)
             {
                 if (!this.IsIgnored(ability))
                 {
                     if (ability is AreaOfEffectAbility || ability is PredictionAbility)
                     {
                         if (args.NewValue)
                         {
                             if (ability is AreaOfEffectAbility)
                             {
                                 if (ability.CastRange > 0f)
                                 {
                                     UpdateManager.BeginInvoke(delegate
                                     {
                                         this.abilityPositions[ability.Handle] = ability.Owner.InFront(ability.CastRange, 0f, true);
                                     }, 10);
                                 }
                                 else
                                 {
                                     UpdateManager.BeginInvoke(delegate
                                     {
                                         this.abilityPositions[ability.Handle] = ability.Owner.Position;
                                     }, 10);
                                 }
                             }
                             this.abilityTimings[ability]   = Game.RawGameTime + ability.CastPoint;
                             this.failSafeHandler.IsEnabled = true;
                         }
                         else
                         {
                             this.abilityTimings.Remove(ability);
                             this.abilityPositions.Remove(ability.Handle);
                             if (this.abilityTimings.Count <= 0)
                             {
                                 this.failSafeHandler.IsEnabled = false;
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex, null);
     }
 }
Exemplo n.º 5
0
        private void OnOrderAdding(OrderAddingEventArgs e)
        {
            try
            {
                if (e.IsCustom || !e.Process)
                {
                    return;
                }

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

                if (order.Type != OrderType.CastPosition || order.Ability.Id != AbilityId.item_blink)
                {
                    return;
                }

                var blink = (ActiveAbility)EntityManager9.GetAbility(order.Ability.Handle);
                var hero  = blink.Owner;

                if (hero.IsChanneling)
                {
                    return;
                }

                var blinkRange    = blink.Range;
                var blinkPosition = order.Position;
                var heroPosition  = hero.Position;
                if (heroPosition.Distance2D(blinkPosition) < blinkRange)
                {
                    return;
                }

                var newBlinkPosition = heroPosition.Extend2D(blinkPosition, blinkRange - 50);
                if (!Hud.IsPositionOnScreen(newBlinkPosition))
                {
                    return;
                }

                blink.UseAbility(newBlinkPosition);
                e.Process = false;
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
Exemplo n.º 6
0
        private void OnOrderAdding(OrderAddingEventArgs e)
        {
            try
            {
                if (!e.Process)
                {
                    return;
                }

                var order     = e.Order;
                var orderType = order.Type;
                if (orderType != OrderType.Cast && orderType != OrderType.CastPosition && orderType != OrderType.CastTarget)
                {
                    return;
                }

                var ability = EntityManager9.GetAbility(order.Ability.Handle);
                if (ability == null)
                {
                    return;
                }

                var owner = ability.Owner;
                if (!owner.Equals(this.ModifierOwner))
                {
                    return;
                }

                var damage = this.netherWard.GetDamage(owner, ability.ManaCost);
                if (damage <= 0)
                {
                    return;
                }

                if (damage > 300 || owner.Health - damage <= 0)
                {
                    e.Process = false;
                }
            }
            catch (Exception ex)
            {
                OrderManager.OrderAdding -= this.OnOrderAdding;
                Logger.Error(ex);
            }
        }
Exemplo n.º 7
0
        private void OnExecuteOrder(Player sender, ExecuteOrderEventArgs args)
        {
            try
            {
                if (!args.Process)
                {
                    return;
                }

                var order = args.OrderId;
                if (order != OrderId.Ability && order != OrderId.AbilityLocation && order != OrderId.AbilityTarget)
                {
                    return;
                }

                var ability = EntityManager9.GetAbility(args.Ability.Handle);
                if (ability == null)
                {
                    return;
                }

                var owner = ability.Owner;
                if (!owner.Equals(this.ModifierOwner))
                {
                    return;
                }

                var damage = this.netherWard.GetDamage(owner, ability.ManaCost);
                if (damage <= 0)
                {
                    return;
                }

                if (damage > 300 || owner.Health - damage <= 0)
                {
                    args.Process = false;
                }
            }
            catch (Exception e)
            {
                Player.OnExecuteOrder -= this.OnExecuteOrder;
                Logger.Error(e);
            }
        }
Exemplo n.º 8
0
        private void OnExecuteOrder(Player sender, ExecuteOrderEventArgs args)
        {
            try
            {
                if (!args.IsPlayerInput || !args.Process || args.IsQueued)
                {
                    return;
                }

                if (args.OrderId != OrderId.AbilityLocation || args.Ability.Id != AbilityId.item_blink)
                {
                    return;
                }

                var blink = (ActiveAbility)EntityManager9.GetAbility(args.Ability.Handle);
                var hero  = blink.Owner;

                if (hero.IsChanneling)
                {
                    return;
                }

                var blinkRange    = blink.Range;
                var blinkPosition = args.TargetPosition;
                var heroPosition  = hero.Position;
                if (heroPosition.Distance2D(blinkPosition) < blinkRange)
                {
                    return;
                }

                var newBlinkPosition = heroPosition.Extend2D(blinkPosition, blinkRange - 50);
                if (!Hud.IsPositionOnScreen(newBlinkPosition))
                {
                    return;
                }

                blink.UseAbility(newBlinkPosition);
                args.Process = false;
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Exemplo n.º 9
0
 // Token: 0x060009F8 RID: 2552 RVA: 0x0002B6A8 File Offset: 0x000298A8
 private void OnExecuteOrder(Player sender, ExecuteOrderEventArgs args)
 {
     try
     {
         if (args.Process && !args.IsPlayerInput && args.OrderId == OrderId.AbilityLocation)
         {
             Ability9 ability = EntityManager9.GetAbility(args.Ability.Handle);
             if (!(ability == null))
             {
                 if (!this.IsIgnored(ability))
                 {
                     this.abilityPositions[ability.Handle] = args.TargetPosition;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex, null);
     }
 }
Exemplo n.º 10
0
        protected void ComboEnd()
        {
            try
            {
                foreach (var abilityHandle in this.disableToggleAbilities.Distinct().ToList())
                {
                    if (!(EntityManager9.GetAbility(abilityHandle) is IToggleable ability))
                    {
                        continue;
                    }

                    UpdateManager.BeginInvoke(() => this.ToggleAbility(ability));
                }

                this.UnitManager.EndCombo(this.ComboModeMenu);
                this.disableToggleAbilities.Clear();
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
Exemplo n.º 11
0
 // Token: 0x060000D7 RID: 215 RVA: 0x0000A440 File Offset: 0x00008640
 protected void ComboEnd()
 {
     try
     {
         foreach (uint num in this.disableToggleAbilities.Distinct <uint>().ToList <uint>())
         {
             IToggleable ability;
             if ((ability = (EntityManager9.GetAbility(num) as IToggleable)) != null)
             {
                 UpdateManager.BeginInvoke(delegate
                 {
                     this.ToggleAbility(ability);
                 }, 0);
             }
         }
         this.UnitManager.EndCombo(this.ComboModeMenu);
         this.disableToggleAbilities.Clear();
     }
     catch (Exception ex)
     {
         Logger.Error(ex, null);
     }
 }
Exemplo n.º 12
0
        private void OnOrderAdding(OrderAddingEventArgs e)
        {
            try
            {
                if (this.ignoreNextOrder)
                {
                    this.ignoreNextOrder = false;
                    return;
                }

                if (!e.Process || this.recoveryKey)
                {
                    return;
                }

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

                var isPlayerInput = !e.IsCustom;

                if (this.orderSync.ForceNextOrderManual)
                {
                    isPlayerInput = true;
                    this.orderSync.ForceNextOrderManual = false;
                }

                if (this.manualOnly && !isPlayerInput)
                {
                    return;
                }

                if (!order.Units.Contains(this.owner))
                {
                    return;
                }

                switch (order.Type)
                {
                case OrderType.Cast:
                {
                    if (order.Ability.Id == AbilityId.item_power_treads)
                    {
                        return;
                    }

                    if (this.switchingThreads)
                    {
                        e.Process = false;
                        return;
                    }

                    var ability = EntityManager9.GetAbility(order.Ability.Handle);
                    if (ability == null)
                    {
                        return;
                    }

                    if (this.PowerTreadsSwitched(ability, false, isPlayerInput))
                    {
                        e.Process = false;
                    }

                    break;
                }

                case OrderType.CastPosition:
                {
                    if (this.switchingThreads)
                    {
                        e.Process = false;
                        return;
                    }

                    var ability = EntityManager9.GetAbility(order.Ability.Handle);
                    if (ability == null)
                    {
                        return;
                    }

                    if (this.PowerTreadsSwitched(ability, order.Position, isPlayerInput))
                    {
                        e.Process = false;
                    }

                    break;
                }

                case OrderType.CastTarget:
                {
                    if (this.switchingThreads)
                    {
                        e.Process = false;
                        return;
                    }

                    var ability = EntityManager9.GetAbility(order.Ability.Handle);
                    if (ability == null)
                    {
                        return;
                    }

                    if (this.PowerTreadsSwitched(ability, (Unit)order.Target, isPlayerInput))
                    {
                        e.Process = false;
                    }

                    break;
                }

                case OrderType.CastToggle:
                {
                    if (order.Ability.IsToggled)
                    {
                        return;
                    }

                    if (this.switchingThreads)
                    {
                        e.Process = false;
                        return;
                    }

                    var ability = EntityManager9.GetAbility(order.Ability.Handle);
                    if (ability == null)
                    {
                        return;
                    }

                    if (this.PowerTreadsSwitched(ability, true, isPlayerInput))
                    {
                        e.Process = false;
                    }

                    break;
                }

                case OrderType.CastRune:
                {
                    if (this.switchingThreads)
                    {
                        e.Process = false;
                        return;
                    }

                    var ability = EntityManager9.GetAbility(order.Ability.Handle);
                    if (ability == null)
                    {
                        return;
                    }

                    if (this.PowerTreadsSwitched(ability, (Rune)order.Target, isPlayerInput))
                    {
                        e.Process = false;
                    }

                    break;
                }
                    //case OrderId.AbilityTargetTree:
                    //{
                    //    break;
                    //}
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
Exemplo n.º 13
0
        private void OnExecuteOrder(Player sender, ExecuteOrderEventArgs args)
        {
            try
            {
                if (this.ignoreNextOrder)
                {
                    this.ignoreNextOrder = false;
                    return;
                }

                if (!args.Process || args.IsQueued || this.recoveryKey)
                {
                    return;
                }

                var isPlayerInput = args.IsPlayerInput;

                if (this.orderSync.ForceNextOrderManual)
                {
                    isPlayerInput = true;
                    this.orderSync.ForceNextOrderManual = false;
                }

                if (this.manualOnly && !isPlayerInput)
                {
                    return;
                }

                if (!args.Entities.Contains(this.owner))
                {
                    return;
                }

                switch (args.OrderId)
                {
                case OrderId.Ability:
                {
                    if (args.Ability.Id == AbilityId.item_power_treads)
                    {
                        return;
                    }

                    if (this.switchingThreads)
                    {
                        args.Process = false;
                        return;
                    }

                    var ability = EntityManager9.GetAbility(args.Ability.Handle);
                    if (ability == null)
                    {
                        return;
                    }

                    if (this.PowerTreadsSwitched(ability, false, isPlayerInput))
                    {
                        args.Process = false;
                    }

                    break;
                }

                case OrderId.AbilityLocation:
                {
                    if (this.switchingThreads)
                    {
                        args.Process = false;
                        return;
                    }

                    var ability = EntityManager9.GetAbility(args.Ability.Handle);
                    if (ability == null)
                    {
                        return;
                    }

                    if (this.PowerTreadsSwitched(ability, args.TargetPosition, isPlayerInput))
                    {
                        args.Process = false;
                    }

                    break;
                }

                case OrderId.AbilityTarget:
                {
                    if (this.switchingThreads)
                    {
                        args.Process = false;
                        return;
                    }

                    var ability = EntityManager9.GetAbility(args.Ability.Handle);
                    if (ability == null)
                    {
                        return;
                    }

                    if (this.PowerTreadsSwitched(ability, (Unit)args.Target, isPlayerInput))
                    {
                        args.Process = false;
                    }

                    break;
                }

                case OrderId.ToggleAbility:
                {
                    if (args.Ability.IsToggled)
                    {
                        return;
                    }

                    if (this.switchingThreads)
                    {
                        args.Process = false;
                        return;
                    }

                    var ability = EntityManager9.GetAbility(args.Ability.Handle);
                    if (ability == null)
                    {
                        return;
                    }

                    if (this.PowerTreadsSwitched(ability, true, isPlayerInput))
                    {
                        args.Process = false;
                    }

                    break;
                }

                case OrderId.AbilityTargetRune:
                {
                    if (this.switchingThreads)
                    {
                        args.Process = false;
                        return;
                    }

                    var ability = EntityManager9.GetAbility(args.Ability.Handle);
                    if (ability == null)
                    {
                        return;
                    }

                    if (this.PowerTreadsSwitched(ability, (Rune)args.Target, isPlayerInput))
                    {
                        args.Process = false;
                    }

                    break;
                }
                    //case OrderId.AbilityTargetTree:
                    //{
                    //    break;
                    //}
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }