Beispiel #1
0
 private void OnAllyInitiator(object sender, InitiatorArgs args)
 {
     try
     {
         if (!Menu.Item(Menu.Name + ".initiator.use-e").GetValue<bool>() || Ball.IsMoving || !E.IsReady() ||
             (Ball.Hero != null && Ball.Hero.NetworkId.Equals(args.Hero.NetworkId)))
         {
             return;
         }
         if (args.Start.Distance(Player.Position) <= E.Range &&
             args.End.Distance(Player.Position) <= _maxBallDistance &&
             GameObjects.EnemyHeroes.Any(
                 e =>
                     !e.IsDead &&
                     (e.Position.Distance(args.End) < 600 || e.Position.Distance(args.Start) < args.Range + 300)))
         {
             E.CastOnUnit(args.Hero);
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }
 private static void OnObjAiBaseProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
 {
     try
     {
         var hero = sender as Obj_AI_Hero;
         if (hero == null || hero.IsMe)
         {
             return;
         }
         var initiator =
             Initiators.FirstOrDefault(
                 i =>
                     !string.IsNullOrEmpty(i.Name) &&
                     i.Name.ToLower().Equals(args.SData.Name.ToLower(), StringComparison.OrdinalIgnoreCase));
         if (initiator != null)
         {
             if (_menu == null ||
                 _menu.Item(_menu.Name + "." + initiator.Hero + "." + initiator.Slot).GetValue<bool>())
             {
                 var eventArgs = new InitiatorArgs(
                     hero, args.Start, args.Target != null ? args.Target.Position : args.End, initiator.Range);
                 OnInitiator.RaiseEvent(null, eventArgs);
                 (hero.IsAlly ? OnAllyInitiator : OnEnemyInitiator).RaiseEvent(null, eventArgs);
             }
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }