예제 #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;
         }
         if (args.Target != null)
         {
             var target = args.Target as Obj_AI_Hero;
             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, args.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 프로젝트: Imatation/sfx
 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));
     }
 }
예제 #3
0
 private void OnEnemyTargetCast(object sender, TargetCastArgs args)
 {
     try
     {
         if (args.Target.IsDead || args.Target.Position.Distance(Player.Position) > 3000)
         {
             return;
         }
         if (Menu.Item(Menu.Name + ".shield.enabled").GetValue<bool>() &&
             (args.Target == null || args.Target.IsMe) && ManaManager.Check("shield"))
         {
             var radius = args.SData.CastRadius + args.Sender.BoundingRadius + Player.BoundingRadius;
             if (args.Type == SpellDataTargetType.SelfAoe && radius <= 1000 &&
                 args.Sender.Distance(Player.Position) <= radius && E.IsReady())
             {
                 E.Cast();
             }
             if (args.Type == SpellDataTargetType.Unit && args.Target != null && args.Target.IsMe)
             {
                 var delay = (int) (Utils.GetSpellDelay(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));
     }
 }