コード例 #1
0
 private static void OnObjAiBaseProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
 {
     try
     {
         var hero = sender as Obj_AI_Hero;
         if (hero == null || !hero.IsValid || hero.IsMe)
         {
             return;
         }
         var target = FixTarget(hero, args.Target, args.SData);
         if (target == null)
         {
             return;
         }
         var enabled = true;
         if (_menu != null)
         {
             var item = _menu.Item(_menu.Name + "." + hero.ChampionName + "." + args.SData.Name);
             enabled = item != null && item.GetValue<bool>();
         }
         if (enabled)
         {
             var eventArgs = new TargetCastArgs(
                 hero, target, args.SData.TargettingType, FixDelay(hero, args.SData), FixSpeed(hero, args.SData),
                 args.SData);
             OnTargetCast.RaiseEvent(null, eventArgs);
             (hero.IsAlly ? OnAllyTargetCast : OnEnemyTargetCast).RaiseEvent(null, eventArgs);
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }
コード例 #2
0
ファイル: Sivir.cs プロジェクト: 4859aa/LeagueSharp-Dev
 private void OnEnemyTargetCast(object sender, TargetCastArgs args)
 {
     try
     {
         if (Menu.Item(Menu.Name + ".shield.enabled").GetValue<bool>() && args.Target.IsMe &&
             ManaManager.Check("shield"))
         {
             if (args.Type == SpellDataTargetType.SelfAoe)
             {
                 E.Cast();
             }
             if (args.Type == SpellDataTargetType.Unit && args.Target != null && args.Target.IsMe)
             {
                 var delay = (int) (Utils.SpellArrivalTime(args.Sender, Player, args.Delay, args.Speed, true)) *
                             1000;
                 var ping = Game.Ping / 2000;
                 if (delay - 200 - ping > 0)
                 {
                     Utility.DelayAction.Add(
                         delay - 100 - ping, delegate
                         {
                             if (E.IsReady())
                             {
                                 E.Cast();
                             }
                         });
                 }
                 else if (E.IsReady())
                 {
                     E.Cast();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }