예제 #1
0
        private static void InitializeSpells()
        {
            if (mustDebug)
            {
                Game.PrintChat("InitializeSpells Start");
            }

            IgniteManager  = new IgniteManager();
            BarrierManager = new BarrierManager();

            Q = new Spell(SpellSlot.Q, 1000);
            Q.SetSkillshot(0.25f, 70f, 1650f, true, SkillshotType.SkillshotLine);

            W = new Spell(SpellSlot.W, 130);

            E = new Spell(SpellSlot.E, 1200);
            E.SetSkillshot(0.25f, 120f, 1400f, false, SkillshotType.SkillshotLine);

            R = new Spell(SpellSlot.R, 1200);
            R.SetSkillshot(1.5f, 225f, float.MaxValue, false, SkillshotType.SkillshotCircle);

            SpellList.Add(Q);
            SpellList.Add(W);
            SpellList.Add(E);
            SpellList.Add(R);

            if (mustDebug)
            {
                Game.PrintChat("InitializeSpells Finish");
            }
        }
예제 #2
0
        private static void InitializeSpells()
        {
            if (mustDebug)
            {
                Game.PrintChat("InitializeSpells Start");
            }

            IgniteManager  = new IgniteManager();
            BarrierManager = new BarrierManager();

            Q = new Spell(SpellSlot.Q, 630);
            W = new Spell(SpellSlot.W, 600);
            E = new Spell(SpellSlot.E, 600);
            R = new Spell(SpellSlot.R);

            SpellList.Add(Q);
            SpellList.Add(W);
            SpellList.Add(E);
            SpellList.Add(R);

            if (mustDebug)
            {
                Game.PrintChat("InitializeSpells Finish");
            }
        }
예제 #3
0
        /// <summary>
        /// Construector.
        /// </summary>
        /// <param name="outReader">Output reader.</param>
        /// <param name="args">Arguments.</param>
        public IgniteProcess(IIgniteProcessOutputReader outReader, params string[] args)
        {
            // Add test dll path
            args = args.Concat(new[] { "-assembly=" + GetType().Assembly.Location }).ToArray();

            _proc = Start(ExePath, IgniteManager.GetIgniteHome(null), outReader, args);
        }
예제 #4
0
        private static void InitializeSpells()
        {
            if (mustDebug)
            {
                Game.PrintChat("InitializeSpells Start");
            }

            Q = new Spell(SpellSlot.Q, 850);
            Q.SetSkillshot(0.6f, 110, float.MaxValue, false, SkillshotType.SkillshotCircle);

            W = new Spell(SpellSlot.W, 850);
            W.SetSkillshot(0.5f, 150, 2500, false, SkillshotType.SkillshotCircle);

            E = new Spell(SpellSlot.E, 700);
            E.SetTargetted(0.1f, float.MaxValue);

            R = new Spell(SpellSlot.R, 850);
            R.SetSkillshot(0.6f, (float)(80 * Math.PI / 180), float.MaxValue, false, SkillshotType.SkillshotCone);

            IgniteManager = new IgniteManager();


            SpellList.Add(Q);
            SpellList.Add(W);
            SpellList.Add(E);
            SpellList.Add(R);

            if (mustDebug)
            {
                Game.PrintChat("InitializeSpells Finish");
            }
        }
예제 #5
0
        private static void InitializeSpells()
        {
            if (mustDebug)
            {
                Game.PrintChat("InitializeSpells Start");
            }

            IgniteManager  = new IgniteManager();
            BarrierManager = new BarrierManager();
            itemManager    = new ItemManager();

            Q = new Spell(SpellSlot.Q);

            W = new Spell(SpellSlot.W, 950);
            W.SetSkillshot(0.25f, 270f, 1400f, false, SkillshotType.SkillshotCircle);

            E = new Spell(SpellSlot.E, 1200);

            R = new Spell(SpellSlot.R, 850);

            SpellList.Add(Q);
            SpellList.Add(W);
            SpellList.Add(E);
            SpellList.Add(R);

            if (mustDebug)
            {
                Game.PrintChat("InitializeSpells Finish");
            }
        }
예제 #6
0
        private static void InitializeSpells()
        {
            if (mustDebug)
            {
                Game.PrintChat("InitializeSpells Start");
            }

            IgniteManager      = new IgniteManager();
            BarrierManager     = new BarrierManager();
            MinionListToIgnore = new List <int>();

            Q = new Spell(SpellSlot.Q, 630);
            Q.SetTargetted(0.2f, float.MaxValue);

            W = new Spell(SpellSlot.W, 600);

            E = new Spell(SpellSlot.E, 600);
            E.SetTargetted(0.2f, float.MaxValue);

            R = new Spell(SpellSlot.R);

            SpellList.Add(Q);
            SpellList.Add(W);
            SpellList.Add(E);
            SpellList.Add(R);

            if (mustDebug)
            {
                Game.PrintChat("InitializeSpells Finish");
            }
        }
예제 #7
0
        public static void Main(string[] args)
        {
            var host = CreateHostBuilder(args).Build();

            IgniteManager.Initialize();

            host.Run();
        }
예제 #8
0
        public void CreateBasicMenu(Menu comboMenu, Menu harassMenu, Menu laneclearMenu, Menu antiGapcloserMenu, Menu interrupterMenu, Menu manamanagerMenu, Menu ignitemanagerMenu, Menu itemMenu, Menu drawingMenu, bool laneclearHarassSwitch = true /*bool healmanager = true,*/)
        {
            if (comboMenu != null)
            {
                CreateComboMenu(comboMenu);
            }

            if (harassMenu != null)
            {
                CreateHarassMenu(harassMenu);
            }

            if (laneclearMenu != null)
            {
                CreateLaneclearMenu(laneclearMenu, laneclearHarassSwitch);
            }

            if (antiGapcloserMenu != null)
            {
                var gapcloserSpells = new Menu("Enemies", "Gapcloser.Enemies");
                AddGapclosersToMenu(gapcloserSpells);
                antiGapcloserMenu.AddSubMenu(gapcloserSpells);
                antiGapcloserMenu.AddMItem("Enabled", true, (sender, args) => AntiGapcloser = args.GetNewValue <bool>());
            }

            if (interrupterMenu != null)
            {
                var spellMenu = new Menu("Spells", "Interrupter.Spells");
                AddInterruptablesToMenu(spellMenu);
                interrupterMenu.AddSubMenu(spellMenu);
                interrupterMenu.AddMItem("Enabled", true, (sender, args) => Interrupter = args.GetNewValue <bool>());
            }

            if (manamanagerMenu != null)
            {
                ManaManager.Initialize(manamanagerMenu);
            }

            if (ignitemanagerMenu != null)
            {
                IgniteManager.Initialize(ignitemanagerMenu, this, true);
            }

            //if (healmanager)
            //{
            //    HealManager.Initialize(healMenu, this);
            //}

            if (itemMenu != null)
            {
                ItemManager.Initialize(itemMenu, this);
            }

            if (drawingMenu != null)
            {
                CreateDrawingMenu(drawingMenu);
            }
        }
예제 #9
0
 /// <summary>
 /// Creates the JVM if necessary.
 /// </summary>
 public static void EnsureJvmCreated()
 {
     if (Jvm.Get(true) == null)
     {
         var logger = new TestContextLogger();
         JvmDll.Load(null, logger);
         IgniteManager.CreateJvm(GetTestConfiguration(), logger);
     }
 }
예제 #10
0
        public void TestIgniteHome()
        {
            var env = Environment.GetEnvironmentVariable(IgniteManager.EnvIgniteHome);

            Environment.SetEnvironmentVariable(IgniteManager.EnvIgniteHome, null);

            try
            {
                Assert.IsTrue(Directory.Exists(IgniteManager.GetIgniteHome(null)));
            }
            finally
            {
                // Restore
                Environment.SetEnvironmentVariable(IgniteManager.EnvIgniteHome, env);
            }
        }
예제 #11
0
        public void CreateBasicMenu(Menu comboMenu, Menu harassMenu, Menu laneclearMenu, Menu antiGapcloserMenu, Menu interrupterMenu, Menu manamanagerMenu, Menu ignitemanagerMenu, bool combo = true, bool harass = true, bool laneclear = true, bool laneclearHarassSwitch = true, bool antiGapcloser = true, bool interrupter = true, bool manamanager = true, bool ignitemanager = true)
        {
            if (combo)
            {
                CreateComboMenu(comboMenu);
            }

            if (harass)
            {
                CreateHarassMenu(harassMenu);
            }

            if (laneclear)
            {
                CreateLaneclearMenu(laneclearMenu, laneclearHarassSwitch);
            }

            if (antiGapcloser)
            {
                var gapcloserSpells = new Menu("Enemies", "Gapcloser.Enemies");
                AddGapclosersToMenu(gapcloserSpells);
                antiGapcloserMenu.AddSubMenu(gapcloserSpells);
                antiGapcloserMenu.AddMItem("Enabled", true, (sender, args) => AntiGapcloser = args.GetNewValue <bool>());
            }

            if (interrupter)
            {
                var spellMenu = new Menu("Spells", "Interrupter.Spells");
                AddInterruptablesToMenu(spellMenu);
                interrupterMenu.AddSubMenu(spellMenu);
                interrupterMenu.AddMItem("Enabled", true, (sender, args) => Interrupter = args.GetNewValue <bool>());
            }

            if (manamanager)
            {
                ManaManager.Initialize(manamanagerMenu);
            }

            if (ignitemanager)
            {
                IgniteManager.Initialize(ignitemanagerMenu);
            }
        }
예제 #12
0
        private static void InitializeSpells()
        {
            IgniteManager  = new IgniteManager();
            BarrierManager = new BarrierManager();

            Q = new Spell(SpellSlot.Q, 600);
            Q.SetTargetted(0.25f, float.MaxValue);

            W = new Spell(SpellSlot.W);

            E = new Spell(SpellSlot.E);

            R = new Spell(SpellSlot.R, 400);
            R.SetTargetted(0.25f, float.MaxValue);

            SpellList.Add(Q);
            SpellList.Add(W);
            SpellList.Add(E);
            SpellList.Add(R);
        }
예제 #13
0
        private static void InitializeSpells()
        {
            IgniteManager  = new IgniteManager();
            BarrierManager = new BarrierManager();

            Q = new Spell(SpellSlot.Q, 1000);
            Q.SetSkillshot(0.25f, 60, 1700, true, SkillshotType.SkillshotLine);

            W = new Spell(SpellSlot.W, 650);
            W.SetTargetted(0.1f, float.MaxValue);

            E = new Spell(SpellSlot.E, 800);
            E.SetTargetted(0.1f, float.MaxValue);

            R = new Spell(SpellSlot.R);

            SpellList.Add(Q);
            SpellList.Add(W);
            SpellList.Add(E);
            SpellList.Add(R);
        }
예제 #14
0
        private static void InitializeSpells()
        {
            igniteManager  = new IgniteManager();
            barrierManager = new BarrierManager();

            Q = new Spell(SpellSlot.Q, 1100);
            Q.SetSkillshot(0.25f, 60, 1600, true, SkillshotType.SkillshotLine);

            W = new Spell(SpellSlot.W, 900);
            W.SetSkillshot(0.85f, 240, float.MaxValue, false, SkillshotType.SkillshotCircle);

            E = new Spell(SpellSlot.E, 650);
            E.SetTargetted(0.2f, float.MaxValue);

            R = new Spell(SpellSlot.R, 750);
            R.SetTargetted(0.2f, float.MaxValue);

            SpellList.Add(Q);
            SpellList.Add(W);
            SpellList.Add(E);
            SpellList.Add(R);
        }
예제 #15
0
        public override void Update()
        {
            if (!(ForceAutoAttacks && ObjectManager.Player.IsWindingUp))
            {
                base.Update();
            }



            var target = TargetSelector.GetTarget(600, TargetSelector.DamageType.True);

            if (target.IsValidTarget())
            {
                var passiveBuff = target.GetBuff("brandablaze");
                if (passiveBuff != null)
                {
                    IgniteManager.Update(this, GetRemainingPassiveDamage(target, passiveBuff), (int)(passiveBuff.EndTime - Game.Time) + 1);
                    return;
                }
            }

            IgniteManager.Update(this); // maybe should use GetTarget!?
        }
예제 #16
0
        /// <summary>
        /// override in sub class to add champion combo logic. for example Garen has a fixed combo, but wants to do W not in order, but when he gets damage.
        /// In this example you would override Update and have a seperate logic for W instead of adding it to the skill routines.
        /// </summary>
        /// <param name="context"></param>
        public virtual void Update(IMainContext context)
        {
            Target = TargetSelector.GetTarget(TargetRange, DamageType);
            IgniteManager.Update(context, Target);
            Skills.Sort(); //Todo: check if expensive. Will do that event-based otherwise

            if (_totalControl)
            {
                TotalControl.Update(_orbwalker.ActiveMode, context, this, Target);

                if (!TotalControl.NeedsControl())
                {
                    TotalControl.TryTerminate(_context);
                    _totalControl = false;
                    Update(context);
                    return;
                }

                // ReSharper disable once LoopCanBeConvertedToQuery
                foreach (var skill in Skills.Where(item => item.GetPriority() > TotalControl.GetPriority()))
                {
                    skill.Update(_orbwalker.ActiveMode, context, this, Target);
                }
            }
            else
            {
                foreach (var item in Skills)
                {
                    if (_cancelUpdate)
                    {
                        _cancelUpdate = false;
                        return;
                    }
                    item.Update(_orbwalker.ActiveMode, context, this, Target);
                }
            }
        }
예제 #17
0
 private void Tick(EventArgs args)
 {
     _comboProvider.Update();
     IgniteManager.Update(_comboProvider);
 }
예제 #18
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public static string CreateTestClasspath()
 {
     return(IgniteManager.CreateClasspath(forceTestClasspath: true));
 }
예제 #19
0
        /// <summary>
        /// Note: Do not use autoattacks as additionalSpellDamage!
        /// </summary>
        /// <param name="target"></param>
        /// <param name="additionalSpellDamage"></param>
        /// <returns></returns>
        public virtual bool ShouldBeDead(Obj_AI_Hero target, float additionalSpellDamage = 0f)
        {
            var healthPred = HealthPrediction.GetHealthPrediction(target, 1);

            return(healthPred - (IgniteManager.GetRemainingDamage(target) + additionalSpellDamage) < 0);
        }
예제 #20
0
        public void Load(EventArgs eArgs)
        {
            _comboProvider = new ComboProvider(new Skill[] { new EkkoQ(new Spell(SpellSlot.Q)), new EkkoW(new Spell(SpellSlot.W)), new EkkoE(new Spell(SpellSlot.E)), new EkkoR(new Spell(SpellSlot.R)) }.ToList(), 1000);

            _mainMenu = CreateMenu("The Ekko", true);
            var orbwalkerMenu      = CreateMenu("Orbwalker", _mainMenu);
            var targetSelectorMenu = CreateMenu("Target Selector", _mainMenu);
            var comboMenu          = CreateMenu("Combo", _mainMenu);
            var harassMenu         = CreateMenu("Harass", _mainMenu);
            //var laneClear = CreateMenu("Laneclear", _mainMenu);
            var antiGapcloser = CreateMenu("Anti Gapcloser", _mainMenu);

            ManaManager.Initialize(_mainMenu, "Manamanager", true, false, false);
            IgniteManager.Initialize(_mainMenu);
            var drawingMenu = CreateMenu("Drawing", _mainMenu);
            var miscMenu    = CreateMenu("Misc", _mainMenu);

            _orbwalker = new Orbwalking.Orbwalker(orbwalkerMenu);
            TargetSelector.AddToMenu(targetSelectorMenu);

            comboMenu.AddMItem("Use Q", true, (sender, args) => _comboProvider.SetEnabled <EkkoQ>(Orbwalking.OrbwalkingMode.Combo, args.GetNewValue <bool>()));
            comboMenu.AddMItem("Use W", true, (sender, args) => _comboProvider.SetEnabled <EkkoW>(Orbwalking.OrbwalkingMode.Combo, args.GetNewValue <bool>()));
            comboMenu.AddMItem("Use E", true, (sender, args) => _comboProvider.SetEnabled <EkkoE>(Orbwalking.OrbwalkingMode.Combo, args.GetNewValue <bool>()));
            comboMenu.AddMItem("Use R", true, (sender, args) => _comboProvider.SetEnabled <EkkoR>(Orbwalking.OrbwalkingMode.Combo, args.GetNewValue <bool>()));
            comboMenu.ProcStoredValueChanged <bool>();
            comboMenu.AddMItem("Min Ult Enemies", new Slider(3, 1, HeroManager.Enemies.Count));
            comboMenu.AddMItem("Min Ult Health %", new Slider(30));
            comboMenu.AddMItem("Ult for Save", true);

            harassMenu.AddMItem("Use Q", true, (sender, args) => _comboProvider.SetEnabled <EkkoQ>(Orbwalking.OrbwalkingMode.Mixed, args.GetNewValue <bool>()));
            harassMenu.ProcStoredValueChanged <bool>();

            //laneClear.AddMItem("Use Q", true, (sender, args) => _comboProvider.SetEnabled<EkkoQ>(Orbwalking.OrbwalkingMode.LaneClear, args.GetNewValue<bool>()));
            //laneClear.ProcStoredValueChanged<bool>();
            ////laneClear.AddMItem("Min Q Farm", new Slider(4, 1, 10), (sender,args) => _comboProvider.GetSkill<EkkoQ>().MinFarm = args.GetNewValue<Slider>().Value);


            var gapcloserSpells = CreateMenu("Enemies");

            _comboProvider.AddGapclosersToMenu(gapcloserSpells);
            antiGapcloser.AddSubMenu(gapcloserSpells);
            antiGapcloser.AddMItem("W on Gapcloser", true, (sender, args) => _comboProvider.GetSkill <EkkoW>().AntiGapcloser = args.GetNewValue <bool>()).ProcStoredValueChanged <bool>();


            _drawQ   = drawingMenu.AddMItem("Draw Q", new Circle(true, Color.OrangeRed));
            _drawQEx = drawingMenu.AddMItem("Draw Q Ex", new Circle(false, Color.Yellow));
            _drawR   = drawingMenu.AddMItem("Draw R", new Circle(true, Color.Red));

            drawingMenu.AddMItem("Damage indicator", new Circle(true, Color.Yellow), (sender, args) =>
            {
                DamageIndicator.Enabled      = args.GetNewValue <Circle>().Active;
                DamageIndicator.Fill         = true;
                DamageIndicator.FillColor    = Color.FromArgb(100, args.GetNewValue <Circle>().Color);
                DamageIndicator.Color        = Color.FromArgb(200, DamageIndicator.FillColor);
                DamageIndicator.DamageToUnit = _comboProvider.GetComboDamage;
            }).ProcStoredValueChanged <Circle>();

            miscMenu.AddMItem("When clearing harass if enemy near", true, (sender, args) => _comboProvider.GetSkills().ToList().ForEach(skill => skill.SwitchClearToHarassOnTarget = args.GetNewValue <bool>()));

            _mainMenu.AddToMainMenu();


            Game.OnUpdate  += Update;
            Drawing.OnDraw += Draw;

            _comboProvider.Initialize(this);
        }
예제 #21
0
        /// <summary>
        /// Starts Ignite with given configuration.
        /// </summary>
        /// <returns>Started Ignite.</returns>
        public unsafe static IIgnite Start(IgniteConfiguration cfg)
        {
            IgniteArgumentCheck.NotNull(cfg, "cfg");

            // Copy configuration to avoid changes to user-provided instance.
            IgniteConfigurationEx cfgEx = cfg as IgniteConfigurationEx;

            cfg = cfgEx == null ? new IgniteConfiguration(cfg) : new IgniteConfigurationEx(cfgEx);

            // Set default Spring config if needed.
            if (cfg.SpringConfigUrl == null)
            {
                cfg.SpringConfigUrl = DefaultCfg;
            }

            lock (SyncRoot)
            {
                // 1. Check GC settings.
                CheckServerGc(cfg);

                // 2. Create context.
                IgniteUtils.LoadDlls(cfg.JvmDllPath);

                var cbs = new UnmanagedCallbacks();

                IgniteManager.CreateJvmContext(cfg, cbs);

                var gridName = cfgEx != null ? cfgEx.GridName : null;

                var cfgPath = Environment.GetEnvironmentVariable(EnvIgniteSpringConfigUrlPrefix) + cfg.SpringConfigUrl;

                // 3. Create startup object which will guide us through the rest of the process.
                _startup = new Startup(cfg, cbs);

                IUnmanagedTarget interopProc = null;

                try
                {
                    // 4. Initiate Ignite start.
                    UU.IgnitionStart(cbs.Context, cfgPath, gridName, ClientMode);

                    // 5. At this point start routine is finished. We expect STARTUP object to have all necessary data.
                    var node = _startup.Ignite;
                    interopProc = node.InteropProcessor;

                    // 6. On-start callback (notify lifecycle components).
                    node.OnStart();

                    Nodes[new NodeKey(_startup.Name)] = node;

                    return(node);
                }
                catch (Exception)
                {
                    // 1. Perform keys cleanup.
                    string name = _startup.Name;

                    if (name != null)
                    {
                        NodeKey key = new NodeKey(name);

                        if (Nodes.ContainsKey(key))
                        {
                            Nodes.Remove(key);
                        }
                    }

                    // 2. Stop Ignite node if it was started.
                    if (interopProc != null)
                    {
                        UU.IgnitionStop(interopProc.Context, gridName, true);
                    }

                    // 3. Throw error further (use startup error if exists because it is more precise).
                    if (_startup.Error != null)
                    {
                        throw _startup.Error;
                    }

                    throw;
                }
                finally
                {
                    _startup = null;

                    if (interopProc != null)
                    {
                        UU.ProcessorReleaseStart(interopProc);
                    }
                }
            }
        }
예제 #22
0
파일: BrandR.cs 프로젝트: wade1990/PortAIO
        public override void Execute(AIHeroClient target)
        {
            if (target == null)
            {
                target = TargetSelector.GetTarget(1200, TargetSelector.DamageType.Magical);
            }
            if (target == null)
            {
                return;
            }

            var dmgPerBounce = ObjectManager.Player.GetSpellDamage(target, Slot) + BrandCombo.GetPassiveDamage(target);

            if (dmgPerBounce > target.Health && target.Distance(ObjectManager.Player) > 750)
            {
                TryBridgeUlt(target);

                //   Console.WriteLine("ayy lmao bridge bois");
            }

            if (dmgPerBounce > target.Health && !Provider.ShouldBeDead(target) && ObjectManager.Player.GetAutoAttackDamage(target, true) < target.Health && ((_otherSkills.All(skill => skill.Instance.State != SpellState.Ready && skill.Instance.State != SpellState.Surpressed /*&& !skill.IsSafeCasting(1)*/) /*|| target.Distance(ObjectManager.Player) > 650*/) || ObjectManager.Player.GetSpellDamage(target, SpellSlot.Q) + dmgPerBounce + ObjectManager.Player.GetAutoAttackDamage(target) > target.Health && !target.HasBuff("brandablaze") && target.Distance(ObjectManager.Player) < 750))
            {
                if (ObjectManager.Player.HealthPercent - target.HealthPercent < OverkillPercent || !AntiOverkill || IgnoreAntiOverkillOnFlee && target.Distance(ObjectManager.Player) > ObjectManager.Player.AttackRange)
                {
                    Cast(target);
                }
                else if (ObjectManager.Player.HealthPercent < target.HealthPercent && IgniteManager.CanBeUsed() && IgniteManager.GetDamage() + dmgPerBounce > target.Health)
                {
                    if (target.Distance(ObjectManager.Player) < 600)
                    {
                        IgniteManager.UseIgnite(target);
                    }
                    Cast(target);
                }
            }


            // if (target.Distance(ObjectManager.Player) > 750) return;
            var inBounce  = new bool[HeroManager.Enemies.Count];
            var canBounce = BounceCheck(target, inBounce);

            if (canBounce)
            {
                var inBounceEnemies = HeroManager.Enemies.Where(enemy => inBounce[HeroManager.Enemies.IndexOf(enemy)]).ToArray();
                var distance        = target.Distance(ObjectManager.Player);

                var bounceCount = inBounce.Count(item => item);
                if (bounceCount <= 1)
                {
                    return;
                }
                //Console.WriteLine("bounce r " + bounceCount);

                if ((inBounceEnemies.Any(enemy => (dmgPerBounce > enemy.Health && MaxDamage > enemy.Health)) && (bounceCount == 2 || RiskyUlt)))
                {
                    TryUlt(target, inBounceEnemies, distance);
                }
                else if (bounceCount == 2 && dmgPerBounce * 3 > target.Health && MaxDamage > target.Health && distance < 750 && RiskyUlt)
                {
                    Cast(target);
                }
                else if (dmgPerBounce * 2 > target.Health && MaxDamage > target.Health)
                {
                    TryUlt(target, inBounceEnemies, distance);
                }
                else if (UltNonKillable && MinBounceTargets <= bounceCount)
                {
                    TryUlt(target, inBounceEnemies, distance, false);
                }
            }
        }
예제 #23
0
        /// <summary>
        /// Starts Ignite with given configuration.
        /// </summary>
        /// <returns>Started Ignite.</returns>
        public static unsafe IIgnite Start(IgniteConfiguration cfg)
        {
            IgniteArgumentCheck.NotNull(cfg, "cfg");

            lock (SyncRoot)
            {
                // 0. Init logger
                var log = cfg.Logger ?? new JavaLogger();

                log.Debug("Starting Ignite.NET " + Assembly.GetExecutingAssembly().GetName().Version);

                // 1. Check GC settings.
                CheckServerGc(cfg, log);

                // 2. Create context.
                IgniteUtils.LoadDlls(cfg.JvmDllPath, log);

                var cbs = new UnmanagedCallbacks(log);

                IgniteManager.CreateJvmContext(cfg, cbs, log);
                log.Debug("JVM started.");

                var gridName = cfg.IgniteInstanceName;

                if (cfg.AutoGenerateIgniteInstanceName)
                {
                    gridName = (gridName ?? "ignite-instance-") + Guid.NewGuid();
                }

                // 3. Create startup object which will guide us through the rest of the process.
                _startup = new Startup(cfg, cbs);

                PlatformJniTarget interopProc = null;

                try
                {
                    // 4. Initiate Ignite start.
                    UU.IgnitionStart(cbs.Context, cfg.SpringConfigUrl, gridName, ClientMode, cfg.Logger != null);


                    // 5. At this point start routine is finished. We expect STARTUP object to have all necessary data.
                    var node = _startup.Ignite;
                    interopProc = (PlatformJniTarget)node.InteropProcessor;

                    var javaLogger = log as JavaLogger;
                    if (javaLogger != null)
                    {
                        javaLogger.SetIgnite(node);
                    }

                    // 6. On-start callback (notify lifecycle components).
                    node.OnStart();

                    Nodes[new NodeKey(_startup.Name)] = node;

                    return(node);
                }
                catch (Exception)
                {
                    // 1. Perform keys cleanup.
                    string name = _startup.Name;

                    if (name != null)
                    {
                        NodeKey key = new NodeKey(name);

                        if (Nodes.ContainsKey(key))
                        {
                            Nodes.Remove(key);
                        }
                    }

                    // 2. Stop Ignite node if it was started.
                    if (interopProc != null)
                    {
                        UU.IgnitionStop(interopProc.Target.Context, gridName, true);
                    }

                    // 3. Throw error further (use startup error if exists because it is more precise).
                    if (_startup.Error != null)
                    {
                        // Wrap in a new exception to preserve original stack trace.
                        throw new IgniteException("Failed to start Ignite.NET, check inner exception for details",
                                                  _startup.Error);
                    }

                    throw;
                }
                finally
                {
                    var ignite = _startup.Ignite;

                    _startup = null;

                    if (ignite != null)
                    {
                        ignite.ProcessorReleaseStart();
                    }
                }
            }
        }
예제 #24
0
        /// <summary>
        /// Application entry point.
        /// </summary>
        internal static void Main(string[] args)
        {
            IgniteConfiguration cfg;

            bool svc     = false;
            bool install = false;

            try
            {
                // Check for special cases.
                if (args.Length > 0)
                {
                    string first = args[0].ToLower();

                    if (Help.Contains(first))
                    {
                        PrintHelp();

                        return;
                    }

                    if (Svc.Equals(first))
                    {
                        args = RemoveFirstArg(args);

                        svc = true;
                    }

                    else if (SvcInstall.Equals(first))
                    {
                        args = RemoveFirstArg(args);

                        install = true;
                    }
                    else if (SvcUninstall.Equals(first))
                    {
                        IgniteService.Uninstall();

                        return;
                    }
                }

                if (!svc)
                {
                    // Pick application configuration.
                    cfg = new IgniteConfiguration();

                    new AppSettingsConfigurator().Configure(cfg, ConfigurationManager.AppSettings);

                    // Pick command line arguments.
                    new ArgsConfigurator().Configure(cfg, args);

                    if (install)
                    {
                        IgniteService.DoInstall(cfg);
                    }
                    else
                    {
                        Ignition.Start(cfg);

                        IgniteManager.DestroyJvm();
                    }

                    return;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("ERROR: " + e.Message);

                Environment.Exit(-1);
            }

            // If we are here, then this is a service call.
            cfg = new IgniteConfiguration();

            // Use only arguments, not app.config.
            new ArgsConfigurator().Configure(cfg, args);

            ServiceBase.Run(new IgniteService(cfg));
        }