示例#1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Web = new WKWebView(View.Bounds, new WKWebViewConfiguration());
            Web.NavigationDelegate = new NavigationDelegate(this);
            Add(Web);

            var loadableViewModel = ViewModel as LoadableViewModel;

            if (loadableViewModel != null)
            {
                loadableViewModel.Bind(x => x.IsLoading).Subscribe(x =>
                {
                    if (x)
                    {
                        NetworkActivity.PushNetworkActive();
                    }
                    else
                    {
                        NetworkActivity.PopNetworkActive();
                    }
                });
            }
        }
        /// <summary>
        ///     The track.
        /// </summary>
        /// <param name="args">
        ///     The args.
        /// </param>
        private void Track(EventArgs args)
        {
            if (this.Unit == null || !this.Unit.IsValid)
            {
                Drawing.OnDraw -= this.Track;
                return;
            }

            if (!Game.IsInGame || Game.IsPaused)
            {
                return;
            }

            if (this.Unit.NetworkActivity == this.lastUnitActivity)
            {
                return;
            }

            this.lastUnitActivity = this.Unit.NetworkActivity;
            if (!this.Unit.IsAttacking())
            {
                if (this.CanCancelAttack())
                {
                    return;
                }

                this.lastUnitActivity      = 0;
                this.nextUnitAttackEnd     = 0;
                this.nextUnitAttackRelease = 0;
                return;
            }

            this.nextUnitAttackEnd     = (float)(Utils.TickCount + UnitDatabase.GetAttackRate(this.Unit) * 1000);
            this.nextUnitAttackRelease = (float)(Utils.TickCount + UnitDatabase.GetAttackPoint(this.Unit) * 1000);
        }
        private void Track(EventArgs args)
        {
            if (Unit == null || !Unit.IsValid)
            {
                Events.OnUpdate -= Track;
                return;
            }

            if (!Game.IsInGame || Game.IsPaused)
            {
                return;
            }

            if (Unit.NetworkActivity == lastUnitActivity)
            {
                return;
            }

            lastUnitActivity = Unit.NetworkActivity;
            if (!Unit.IsAttacking())
            {
                if (CanCancelAttack())
                {
                    return;
                }

                lastUnitActivity      = 0;
                nextUnitAttackEnd     = 0;
                nextUnitAttackRelease = 0;
                return;
            }

            nextUnitAttackEnd     = (float)(Utils.TickCount + (UnitDatabase.GetAttackRate(Unit) * 1000));
            nextUnitAttackRelease = (float)(Utils.TickCount + (UnitDatabase.GetAttackPoint(Unit) * 1000));
        }
        /// <summary>
        ///     The entity_ on int 32 property change.
        /// </summary>
        /// <param name="sender">
        ///     The sender.
        /// </param>
        /// <param name="args">
        ///     The args.
        /// </param>
        private void Entity_OnInt32PropertyChange(Entity sender, Int32PropertyChangeEventArgs args)
        {
            if (!sender.Equals(this.Unit) || args.PropertyName != "m_NetworkActivity")
            {
                return;
            }

            if (this.Unit == null || !this.Unit.IsValid)
            {
                Entity.OnInt32PropertyChange -= this.Entity_OnInt32PropertyChange;
                return;
            }

            if (!Game.IsInGame || Game.IsPaused)
            {
                return;
            }

            var newValue = (NetworkActivity)args.NewValue;
            var oldValue = (NetworkActivity)args.OldValue;

            if (newValue == this.lastUnitActivity || newValue == oldValue)
            {
                return;
            }

            var canCancel    = this.CanCancelAttack();
            var wasAttacking = false;

            if (!this.IsAttackOnCoolDown() || canCancel)
            {
                wasAttacking          = this.isAttacking;
                this.lastUnitActivity = newValue;
                this.isAttacking      = newValue == NetworkActivity.Attack || newValue == NetworkActivity.Crit ||
                                        newValue == NetworkActivity.Attack2 || newValue == NetworkActivity.AttackEvent ||
                                        newValue == NetworkActivity.AttackEventBash ||
                                        newValue == NetworkActivity.EarthshakerTotemAttack;
            }

            if (wasAttacking && canCancel && !this.isAttacking &&
                (oldValue == NetworkActivity.Attack || oldValue == NetworkActivity.Crit ||
                 oldValue == NetworkActivity.Attack2 || oldValue == NetworkActivity.AttackEvent ||
                 oldValue == NetworkActivity.AttackEventBash || oldValue == NetworkActivity.EarthshakerTotemAttack))
            {
                this.AttackEnd();
            }

            if (!this.isAttacking || (!this.isAttacking && !canCancel))
            {
                return;
            }

            this.LastUnitAttackStart = Game.RawGameTime;
            this.NextUnitAttackEnd   =
                (float)(this.LastUnitAttackStart * 1000 + UnitDatabase.GetAttackRate(this.Unit) * 1000);
            this.NextUnitAttackRelease =
                (float)(this.LastUnitAttackStart * 1000 + UnitDatabase.GetAttackPoint(this.Unit) * 1000);
            this.AttackOrderSent = false;
            this.AttackStart();
        }
示例#5
0
        private async Task Save()
        {
            if (_model.Files.Count(x => x.Value != null) == 0)
            {
                AlertDialogService.ShowAlert("No Files", "You cannot modify a Gist without atleast one file");
                return;
            }

            var app = MvvmCross.Platform.Mvx.Resolve <Core.Services.IApplicationService>();
            var hud = this.CreateHud();

            NetworkActivity.PushNetworkActive();

            try
            {
                hud.Show("Saving...");
                var newGist = await app.GitHubClient.Gist.Edit(_originalGist.Id, _model);

                Created?.Invoke(newGist);
                DismissViewController(true, null);
            }
            catch (Exception e)
            {
                AlertDialogService.ShowAlert("Error", "Unable to save gist: " + e.Message);
            }
            finally
            {
                hud.Hide();
                NetworkActivity.PopNetworkActive();
            }
        }
示例#6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            NetworkActivity.PushNetworkActive();
            Load().ContinueWith(t => NetworkActivity.PopNetworkActive()).ToBackground();
        }
示例#7
0
        private async Task Save()
        {
            if (_model.Files.Count(x => x.Value != null) == 0)
            {
                AlertDialogService.ShowAlert("No Files", "You cannot modify a Gist without atleast one file");
                return;
            }

            var app = MvvmCross.Platform.Mvx.Resolve <CodeHub.Core.Services.IApplicationService>();
            var hud = this.CreateHud();

            NetworkActivity.PushNetworkActive();

            try
            {
                hud.Show("Saving...");
                var newGist = await app.Client.ExecuteAsync(app.Client.Gists[_originalGist.Id].EditGist(_model));

                Created?.Invoke(newGist.Data);
                DismissViewController(true, null);
            }
            finally
            {
                hud.Hide();
                NetworkActivity.PopNetworkActive();
            }
        }
示例#8
0
 private void ActivateLoadingIndicator()
 {
     if (!_networkActivity)
     {
         NetworkActivity.PushNetworkActive();
     }
     _networkActivity = true;
 }
示例#9
0
 private void DeactivateLoadingIndicator()
 {
     if (_networkActivity)
     {
         NetworkActivity.PopNetworkActive();
     }
     _networkActivity = false;
 }
示例#10
0
        protected virtual void OnLoadStarted(object sender, EventArgs e)
        {
            NetworkActivity.PushNetworkActive();

            if (RefreshButton != null)
            {
                RefreshButton.Enabled = false;
            }
        }
示例#11
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            ViewDidLoadCalled.Raise(this);

            var loadableViewModel = ViewModel as LoadableViewModel;

            if (loadableViewModel != null)
            {
                RefreshControl = new UIRefreshControl();
                OnActivation(d =>
                {
                    d(loadableViewModel.Bind(x => x.IsLoading, true).Subscribe(x =>
                    {
                        if (x)
                        {
                            NetworkActivity.PushNetworkActive();
                            RefreshControl.BeginRefreshing();

                            if (!_manualRefreshRequested)
                            {
                                UIView.Animate(0.25, 0f, UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.CurveEaseOut,
                                               () => TableView.ContentOffset = new CoreGraphics.CGPoint(0, -RefreshControl.Frame.Height), null);
                            }

                            foreach (var t in (ToolbarItems ?? Enumerable.Empty <UIBarButtonItem>()))
                            {
                                t.Enabled = false;
                            }
                        }
                        else
                        {
                            NetworkActivity.PopNetworkActive();

                            if (RefreshControl.Refreshing)
                            {
                                // Stupid bug...
                                BeginInvokeOnMainThread(() =>
                                {
                                    UIView.Animate(0.25, 0.0, UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.CurveEaseOut,
                                                   () => TableView.ContentOffset = new CoreGraphics.CGPoint(0, 0), null);
                                    RefreshControl.EndRefreshing();
                                });
                            }

                            foreach (var t in (ToolbarItems ?? Enumerable.Empty <UIBarButtonItem>()))
                            {
                                t.Enabled = true;
                            }

                            _manualRefreshRequested = false;
                        }
                    }));
                });
            }
        }
示例#12
0
 public CounterHelp(ClassID hero, string strKey = "", int intKey    = 0,
                    NetworkActivity activity    = 0, string modifer = "")
     : this()
 {
     Hero     = hero;
     Modifer  = modifer;
     Activity = activity;
     IntKey   = intKey;
     StrKey   = strKey;
 }
示例#13
0
        protected virtual void OnLoadError(NSError error)
        {
            NetworkActivity.PopNetworkActive();

            if (BackButton != null)
            {
                BackButton.Enabled    = Web.CanGoBack;
                ForwardButton.Enabled = Web.CanGoForward;
                RefreshButton.Enabled = true;
            }
        }
示例#14
0
 private static void Events_OnClose(object sender, EventArgs e)
 {
     if (!loaded)
     {
         return;
     }
     Game.OnUpdate  -= Game_OnUpdate;
     LastAttackStart = 0;
     lastActivity    = 0;
     me     = null;
     loaded = false;
 }
示例#15
0
        public IHttpActionResult PostNetworkActivity(NetworkActivity networkActivity)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.NetworkActivity.Add(networkActivity);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = networkActivity.ID }, networkActivity));
        }
示例#16
0
 /// <summary>
 ///     Loads orbwalking if its not loaded yet
 /// </summary>
 public static void Load()
 {
     if (loaded)
     {
         return;
     }
     Game.OnUpdate  += Game_OnUpdate;
     LastAttackStart = 0;
     lastActivity    = 0;
     me     = null;
     loaded = true;
 }
示例#17
0
 private static void Events_OnLoad(object sender, EventArgs e)
 {
     if (loaded)
     {
         return;
     }
     Game.OnUpdate  += Game_OnUpdate;
     LastAttackStart = 0;
     lastActivity    = 0;
     me     = null;
     loaded = true;
 }
        private async Task Load()
        {
            NetworkActivity.PushNetworkActive();

            try
            {
                await LoadLanguages();
            }
            finally
            {
                NetworkActivity.PopNetworkActive();
            }
        }
示例#19
0
        public IHttpActionResult DeleteNetworkActivity(int id)
        {
            NetworkActivity networkActivity = db.NetworkActivity.Find(id);

            if (networkActivity == null)
            {
                return(NotFound());
            }

            db.NetworkActivity.Remove(networkActivity);
            db.SaveChanges();

            return(Ok(networkActivity));
        }
示例#20
0
        public async override void ViewDidLoad()
        {
            base.ViewDidLoad();

            try
            {
                NetworkActivity.PushNetworkActive();
                var app = MvvmCross.Platform.Mvx.Resolve <CodeHub.Core.Services.IApplicationService>();
                await _milestones.SimpleCollectionLoad(app.Client.Users[_username].Repositories[_repository].Milestones.GetAll(), false);
            }
            catch {
            }
            finally
            {
                NetworkActivity.PopNetworkActive();
            }
        }
示例#21
0
        protected virtual void OnLoadFinished(object sender, EventArgs e)
        {
            NetworkActivity.PopNetworkActive();

            if (BackButton != null)
            {
                BackButton.Enabled    = Web.CanGoBack;
                ForwardButton.Enabled = Web.CanGoForward;
                RefreshButton.Enabled = true;
            }

            if (_showPageAsTitle)
            {
                Web.EvaluateJavaScript("document.title", (o, _) => {
                    Title = o as NSString;
                });
            }
        }
示例#22
0
        private async Task CommitThis(string message)
        {
            var content = _descriptionElement.Value;
            var name    = _titleElement.Value;
            var path    = string.IsNullOrEmpty(_path) ? name : $"{_path.TrimEnd('/')}/{name}";
            var hud     = this.CreateHud();

            try
            {
                hud.Show("Committing...");
                UIApplication.SharedApplication.BeginIgnoringInteractionEvents();
                NetworkActivity.PushNetworkActive();

                var encodedPath = path == null ? null : System.Net.WebUtility.UrlEncode(path);

                var result = await _applicationService.GitHubClient.Repository.Content.CreateFile(
                    _username, _repository, encodedPath, new Octokit.CreateFileRequest(message, content, _branch));

                this.PresentingViewController?.DismissViewController(true, null);

                _successSubject.OnNext(result);
            }
            catch (Octokit.ApiException ex)
            {
                var errorMessage = ex.Message;
                if (ex.ApiError?.DocumentationUrl == "https://developer.github.com/v3/repos/contents/#update-a-file")
                {
                    errorMessage = "A file with that name already exists!";
                }

                AlertDialogService.ShowAlert("Error", errorMessage);
            }
            catch (Exception ex)
            {
                AlertDialogService.ShowAlert("Error", ex.Message);
            }
            finally
            {
                UIApplication.SharedApplication.EndIgnoringInteractionEvents();
                NetworkActivity.PopNetworkActive();
                hud.Hide();
            }
        }
示例#23
0
        private static ICollection <Section> RenderSections(IEnumerable <Section> sections, Action moreAction)
        {
            var weakAction = new WeakReference <Action>(moreAction);
            ICollection <Section> newSections = new LinkedList <Section>(sections);

            if (moreAction != null)
            {
                var loadMore = new PaginateElement("Load More", "Loading...")
                {
                    AutoLoadOnVisible = true
                };
                newSections.Add(new Section {
                    loadMore
                });
                loadMore.Tapped += async(obj) =>
                {
                    try
                    {
                        NetworkActivity.PushNetworkActive();

                        var a = weakAction.Get();
                        if (a != null)
                        {
                            await Task.Run(a);
                        }

                        var root = loadMore.GetRootElement();
                        root?.Remove(loadMore.Section, UITableViewRowAnimation.Fade);
                    }
                    catch (Exception e)
                    {
                        AlertDialogService.ShowAlert("Unable to load more!", e.Message);
                    }
                    finally
                    {
                        NetworkActivity.PopNetworkActive();
                    }
                };
            }

            return(newSections);
        }
示例#24
0
        public override View GetView(int index, View convertView, ViewGroup parent)
        {
            var view      = activity.LayoutInflater.Inflate(Resource.Layout.MainListItem, parent, false);
            var network   = netList[index];
            var mainTitle = view.FindViewById <TextView>(Resource.Id.textView1);

            mainTitle.Text = netList[index].Name;
            var cardview = view.FindViewById <CardView>(Resource.Id.itemCardView);

            view.FindViewById <TextView>(Resource.Id.panel_count).Text  = network.Panels.ToString();
            view.FindViewById <TextView>(Resource.Id.panel_energy).Text = $"{network.PanelsEnergy.ToString("0.00")} kW";

            view.FindViewById <TextView>(Resource.Id.consumer_count).Text  = network.Consumers.ToString();
            view.FindViewById <TextView>(Resource.Id.consumer_energy).Text = $"{network.ConsumersEnergy.ToString("0.00")} kW";

            cardview.Click += delegate
            {
                activity.StartActivity(NetworkActivity.CreateIntent(activity, netList[index].ID));
            };
            var del = view.FindViewById <Button>(Resource.Id.delete_button);

            del.Click += delegate
            {
                Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(activity);
                alertDialog.SetTitle("Delete network");
                alertDialog.SetMessage("Are you sure you want to delete this network?");
                alertDialog.SetNeutralButton("Yes", async delegate
                {
                    await DeleteNetwork(netList[index]);
                    alertDialog.Dispose();
                });
                alertDialog.SetNegativeButton("No", delegate
                {
                    alertDialog.Dispose();
                });
                alertDialog.Show();
            };
            return(view);
        }
示例#25
0
        private static void Game_OnUpdate(EventArgs args)
        {
            if (me == null)
            {
                me = ObjectMgr.LocalHero;
            }
            if (!Game.IsInGame || me == null || Game.IsPaused)
            {
                if (Game.IsInGame && me != null)
                {
                    return;
                }
                LastAttackStart = 0;
                lastActivity    = 0;
                me = null;
                return;
            }
            //Console.WriteLine("a");
            tick = Environment.TickCount;
            if (me.NetworkActivity == lastActivity)
            {
                return;
            }
            lastActivity = me.NetworkActivity;
            //Console.WriteLine(lastActivity);
            if (!me.IsAttacking())
            {
                return;
            }

            //if (orbwalkTarget != null)
            //{
            //    LastAttackStart = (float)(tick + me.GetTurnTime(orbwalkTarget) * 1000);
            //}
            //else
            //{
            LastAttackStart = tick;
            // }
        }
示例#26
0
        void AddCommentTapped()
        {
            var composer = new MarkdownComposerViewController();

            composer.PresentAsModal(this, async text =>
            {
                var hud = composer.CreateHud();

                using (UIApplication.SharedApplication.DisableInteraction())
                    using (NetworkActivity.ActivateNetwork())
                        using (hud.Activate("Commenting..."))
                        {
                            try
                            {
                                await ViewModel.AddComment(text);
                                composer.DismissViewController(true, null);
                            }
                            catch (Exception e)
                            {
                                AlertDialogService.ShowAlert("Unable to post comment!", e.Message);
                            }
                        }
            });
        }
示例#27
0
        private static void Game_OnUpdate(EventArgs args)
        {
            #region Init

            var me = ObjectMgr.LocalHero;
            if (!_loaded)
            {
                if (!Game.IsInGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Invoker)
                {
                    return;
                }
                _loaded = true;
                _combo = 0;


                var q = me.Spellbook.SpellQ;
                var w = me.Spellbook.SpellW;
                var e = me.Spellbook.SpellE;

                var ss = me.FindSpell("invoker_sun_strike");
                var coldsnap = me.FindSpell("invoker_cold_snap");
                var ghostwalk = me.FindSpell("invoker_ghost_walk");
                var icewall = me.FindSpell("invoker_ice_wall");
                var tornado = me.FindSpell("invoker_tornado");
                var blast = me.FindSpell("invoker_deafening_blast");
                var forgeSpirit = me.FindSpell("invoker_forge_spirit");
                var emp = me.FindSpell("invoker_emp");
                var alacrity = me.FindSpell("invoker_alacrity");
                var meteor = me.FindSpell("invoker_chaos_meteor");

                SpellInfo.Add(ss.Name, new SpellStruct(e, e, e));
                SpellInfo.Add(coldsnap.Name, new SpellStruct(q, q, q));
                SpellInfo.Add(ghostwalk.Name, new SpellStruct(q, q, w));
                SpellInfo.Add(icewall.Name, new SpellStruct(q, q, e));
                SpellInfo.Add(tornado.Name, new SpellStruct(w, w, q));
                SpellInfo.Add(blast.Name, new SpellStruct(q, w, e));
                SpellInfo.Add(forgeSpirit.Name, new SpellStruct(e, e, q));
                SpellInfo.Add(emp.Name, new SpellStruct(w, w, w));
                SpellInfo.Add(alacrity.Name, new SpellStruct(w, w, e));
                SpellInfo.Add(meteor.Name, new SpellStruct(e, e, w));

                Combos[_maxCombo] = new ComboStruct(new[] {ss, meteor, blast, coldsnap, forgeSpirit}, 5, true);
                Combos[_maxCombo] =
                    new ComboStruct(new[] {tornado, ss, meteor, blast, tornado, coldsnap, alacrity, forgeSpirit},5);
                Combos[_maxCombo] = new ComboStruct(new[] {tornado, emp, ss, meteor, blast, tornado, coldsnap},5);
                Combos[_maxCombo] = new ComboStruct(new[] {tornado, emp, meteor, blast, coldsnap},5);
                Combos[_maxCombo] = new ComboStruct(new[] {tornado, meteor, blast},3);
                Combos[_maxCombo] = new ComboStruct(new[] {tornado, emp, blast},3);
                Combos[_maxCombo] = new ComboStruct(new[] {tornado, emp, icewall},3);
                Combos[_maxCombo] = new ComboStruct(new[] {tornado, ss, icewall},3);
                Combos[_maxCombo] = new ComboStruct(new[] {tornado, blast, coldsnap},3);
                Combos[_maxCombo] = new ComboStruct(new[] {tornado, emp, coldsnap},3);
                Combos[_maxCombo] = new ComboStruct(new[] {coldsnap, alacrity, forgeSpirit},3);
                Combos[_maxCombo] = new ComboStruct(new[] {tornado, emp, meteor,blast,ss,icewall},5);

                Game.PrintMessage(
                    "<font face='Comic Sans MS, cursive'><font color='#00aaff'>" + Menu.DisplayName + " By Jumpering" +
                    " loaded!</font> <font color='#aa0000'>v"  + Ver, MessageType.LogMessage);
                PrintSuccess(string.Format("> {1} Loaded v{0}", Ver, Menu.DisplayName));
                /*PrintInfo("===============Combo selection===============");
                for (var i = 0; i < _maxCombo; i++)
                    PrintInfo(string.Format("Init new combo--> {0}", Combos[i]));
                PrintInfo("============================================");*/
            }

            if (!Game.IsInGame || me == null)
            {
                _loaded = false;
                PrintInfo("> Invorker Annihilation unLoaded");
                return;
            }

            if (Game.IsPaused)
            {
                return;
            }
            //PrintInfo(me.NetworkActivity.ToString());
            if (Utils.SleepCheck("act") && !_inAction && Menu.Item("smartIsActive").GetValue<bool>())
            {
                Ability spell = null;
                switch (Menu.Item("OnMoving").GetValue<StringList>().SelectedIndex)
                {
                    case (int) SmartSphereEnum.Quas:
                        spell = me.Spellbook.SpellQ;
                        break;
                    case (int) SmartSphereEnum.Wex:
                        spell = me.Spellbook.SpellW;
                        break;
                }
                if (me.NetworkActivity == NetworkActivity.Move && me.NetworkActivity != _lastAct && !me.IsInvisible())
                {
                    if (spell != null && spell.CanBeCasted())
                    {
                        spell.UseAbility();
                        spell.UseAbility();
                        spell.UseAbility();
                    }
                }
                _lastAct = me.NetworkActivity;
            }

            #endregion
            
            #region Get needed spells

            if (_startInitSpell && Utils.SleepCheck("GettingNeededSpells"))
            {
                _startInitSpell = false;
                InvokeNeededSpells(me);
            }

            #endregion

            #region Starting Combo

            if (!_inAction)
            {
                _globalTarget = null;
                return;
            }
            if (_globalTarget == null || !_globalTarget.IsValid)
            {
                _globalTarget = ClosestToMouse(me);
            }
            if (_globalTarget == null || !_globalTarget.IsValid || !_globalTarget.IsAlive || !me.CanCast()) return;

            ComboInAction(me, _globalTarget);
            /*
            var target = ClosestToMouse(me);
            if (_ssprediction || _showsSsDamage || _sunstrikekill)
            {
                _globalTarget = target;
            }
            else
            {
                if (_predictionEffect != null)
                {
                    _predictionEffect.Dispose();
                    _predictionEffect = null;
                }
            }
            if (_inAction && target != null && target.IsAlive)
                ComboInAction(me, target);
            */
            #endregion
        }
示例#28
0
        public static void Game_OnUpdate(EventArgs args)
        {
            if (!OnUpdateChecks.CanUpdate())
            {
                return;
            }

            MyHeroInfo.UpdatePosition();
            var enemyHeroes = EnemyHeroes.UsableHeroes;
            var allyHeroes  = AllyHeroes.UsableHeroes;

            GankDamage.UpdateDamage(enemyHeroes, allyHeroes);
            if (!Me.IsAlive || Me.IsChanneling() || Me.HasModifier("modifier_spirit_breaker_charge_of_darkness") ||
                (MyAbilities.ChargeOfDarkness != null && MyAbilities.ChargeOfDarkness.IsValid &&
                 MyAbilities.ChargeOfDarkness.IsInAbilityPhase) || !Utils.SleepCheck("Ability#.Sleep"))
            {
                return;
            }

            var keyDown = Game.IsKeyDown(MainMenu.ComboKeysMenu.Item("abilityKey1").GetValue <KeyBind>().Key);

            if (Utils.SleepCheck("cancelorder") || !keyDown)
            {
                if (lastOrderPosition != Vector3.Zero && lastActivity == NetworkActivity.Move)
                {
                    var ctarget = TargetSelector.ClosestToMouse(Me, 150);
                    if (ctarget != null && ctarget.IsValid)
                    {
                        Me.Attack(ctarget);
                    }
                    else
                    {
                        Me.Move(lastOrderPosition);
                    }

                    lastOrderPosition = Vector3.Zero;
                }
            }
            else
            {
                lastActivity      = Me.NetworkActivity;
                lastOrderPosition = Game.MousePosition;
            }

            var ping = Game.Ping;

            var invisible = Me.IsInvisible() && Me.ClassID != ClassID.CDOTA_Unit_Hero_Riki &&
                            (!Me.HasModifier("modifier_templar_assassin_meld") || !Orbwalking.CanCancelAnimation());

            if (!invisible && MainMenu.Menu.Item("Ability#.EnableAutoUsage").GetValue <bool>() &&
                MyAbilities.DefensiveAbilities.Any() && Utils.SleepCheck("casting"))
            {
                if (Utils.SleepCheck("Orbwalk.Attack") &&
                    allyHeroes.Any(allyHero => FullCombo.DeffensiveAutoUsage(allyHero, Me, enemyHeroes, ping)))
                {
                    return;
                }
            }

            var targetLock =
                MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.TargetLock").GetValue <StringList>().SelectedIndex;

            if (!keyDown)
            {
                target = null;
            }

            if (Game.IsChatOpen)
            {
                return;
            }

            var meMissingHp = Me.MaximumHealth - Me.Health;
            var meMana      = Me.Mana;

            ManageAutoAttack.UpdateAutoAttack();

            if (keyDown)
            {
                if (Utils.SleepCheck("UpdateTarget") &&
                    (target == null || !target.IsValid || !target.IsAlive || !target.IsVisible ||
                     (target.IsVisible && targetLock <= 1)))
                {
                    var mode =
                        MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.Target").GetValue <StringList>().SelectedIndex;
                    target = mode == 0
                                 ? TargetSelector.ClosestToMouse(Me, 2000)
                                 : EnemyHeroes.UsableHeroes.Where(x => x.Distance2D(Me) < 2000)
                             .MaxOrDefault(x => x.GetDoableDamage());
                    Utils.Sleep(250, "UpdateTarget");
                }

                var selectedCombo = MainMenu.ComboKeysMenu.Item("abilityComboType").GetValue <StringList>().SelectedIndex;
                var combo         = false;
                if (!invisible && target != null && Orbwalking.CanCancelAnimation() && Utils.SleepCheck("Orbwalk.Attack"))
                {
                    combo = FullCombo.Execute(
                        target,
                        enemyHeroes,
                        ping,
                        selectedCombo == 2,
                        selectedCombo == 1,
                        Me,
                        meMana,
                        selectedCombo == 3);
                }

                if (!combo &&
                    (target == null ||
                     (target.Distance2D(MyHeroInfo.Position) > 500 && Me.HasModifier("modifier_pudge_rot") &&
                      !target.HasModifier("modifier_pudge_meat_hook"))) &&
                    AllyHeroes.AbilityDictionary.ContainsKey(Me.StoredName()))
                {
                    foreach (var ability in AllyHeroes.AbilityDictionary[Me.StoredName()].Where(x => x.IsToggled))
                    {
                        var handle = ability.Handle.ToString();
                        if (!Utils.SleepCheck(handle))
                        {
                            continue;
                        }

                        ability.ToggleAbility();
                        Utils.Sleep(500 + Game.Ping, handle);
                        return;
                    }
                }

                if (Me.ClassID == ClassID.CDOTA_Unit_Hero_TemplarAssassin && target != null && target.IsVisible)
                {
                    var meld = Me.Spellbook.SpellW;
                    if (meld.ManaCost <= meMana && meld.Cooldown >= 0 && meld.Cooldown < UnitDatabase.GetAttackRate(Me) &&
                        target.Health > Dictionaries.HitDamageDictionary[target.Handle] * 2)
                    {
                        if (!Utils.SleepCheck("Ability.Move"))
                        {
                            return;
                        }

                        Me.Move(Game.MousePosition);
                        Utils.Sleep(100, "Ability.Move");
                        return;
                    }
                }

                if (combo || !Utils.SleepCheck("GlobalCasting") ||
                    (!(Game.MousePosition.Distance2D(Me)
                       > MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.NoMoveRange").GetValue <Slider>().Value) &&
                     (target == null || !(Me.Distance2D(target) <= MyHeroInfo.AttackRange() + 100))))
                {
                    return;
                }

                MoveMode(target);
            }

            if (!invisible && MainMenu.Menu.Item("Ability#.EnableAutoKillSteal").GetValue <bool>() &&
                Utils.SleepCheck("casting"))
            {
                Variables.Killsteal.FindTarget(enemyHeroes, Me);
                if (Variables.Killsteal.TryKillsteal(Me, ping, enemyHeroes))
                {
                    return;
                }
            }

            if (!invisible && MainMenu.Menu.Item("Ability#.EnableAutoUsage").GetValue <bool>() &&
                Utils.SleepCheck("Orbwalk.Attack") &&
                enemyHeroes.Any(
                    enemyHero => Variables.AutoUsage.Try(enemyHero, enemyHeroes, meMissingHp, ping, Me, meMana)))
            {
                return;
            }
        }
示例#29
0
        public static void Game_OnUpdate(EventArgs args)
        {
            if (!OnUpdateChecks.CanUpdate())
            {
                return;
            }

            MyHeroInfo.UpdatePosition();
            ManageAutoAttack.UpdateAutoAttack();
            var enemyHeroes = EnemyHeroes.UsableHeroes;
            var allyHeroes = AllyHeroes.UsableHeroes;
            GankDamage.UpdateDamage(enemyHeroes, allyHeroes);
            if (!Me.IsAlive
                || (Me.IsInvisible() && !Me.IsVisibleToEnemies && Me.ClassID != ClassID.CDOTA_Unit_Hero_Riki
                    && (!Me.HasModifier("modifier_templar_assassin_meld")
                        || !Orbwalking.CanCancelAnimation())) || Me.IsChanneling())
            {
                return;
            }

            if (Utils.SleepCheck("cancelorder"))
            {
                if (lastOrderPosition != Vector3.Zero && lastActivity == NetworkActivity.Move)
                {
                    var ctarget = TargetSelector.ClosestToMouse(Me, 150);
                    if (ctarget != null && ctarget.IsValid)
                    {
                        Me.Attack(ctarget);
                    }
                    else
                    {
                        Me.Move(lastOrderPosition);
                    }

                    lastOrderPosition = Vector3.Zero;
                }
            }
            else
            {
                lastActivity = Me.NetworkActivity;
                lastOrderPosition = Game.MousePosition;
            }

            var ping = Game.Ping;

            if (MyAbilities.DeffensiveAbilities.Any() && Utils.SleepCheck("casting"))
            {
                if (Utils.SleepCheck("Orbwalk.Attack")
                    && allyHeroes.Any(allyHero => FullCombo.DeffensiveAutoUsage(allyHero, Me, enemyHeroes, ping)))
                {
                    return;
                }
            }

            var targetLock =
                MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.TargetLock").GetValue<StringList>().SelectedIndex;

            var keyDown = Game.IsKeyDown(MainMenu.ComboKeysMenu.Item("abilityKey1").GetValue<KeyBind>().Key);

            if (!keyDown)
            {
                target = null;
            }

            if (!MyAbilities.OffensiveAbilities.Any())
            {
                if (Game.IsChatOpen)
                {
                    return;
                }

                if (keyDown)
                {
                    if (Utils.SleepCheck("UpdateTarget")
                        && (target == null || !target.IsValid || !target.IsAlive || (!target.IsVisible && targetLock == 0)))
                    {
                        var mode =
                            MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.Target").GetValue<StringList>().SelectedIndex;
                        target = mode == 0
                                     ? TargetSelector.ClosestToMouse(Me, 2000)
                                     : EnemyHeroes.UsableHeroes.Where(x => x.Distance2D(Me) < 2000)
                                           .MaxOrDefault(x => x.GetDoableDamage());
                        Utils.Sleep(250, "UpdateTarget");
                    }

                    if (target != null && !target.IsValid)
                    {
                        target = null;
                    }

                    if (Utils.SleepCheck("GlobalCasting")
                        && (Game.MousePosition.Distance2D(Me)
                            > MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.NoMoveRange").GetValue<Slider>().Value
                            || (target != null
                                && Me.Distance2D(target)
                                <= MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.NoMoveRange").GetValue<Slider>().Value)))
                    {
                        var mode =
                            MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.Mode").GetValue<StringList>().SelectedIndex;
                        switch (mode)
                        {
                            case 0:

                                Orbwalking.Orbwalk(target, attackmodifiers: true);
                                break;
                            case 1:
                                if (!Utils.SleepCheck("Ability.Move"))
                                {
                                    return;
                                }

                                Me.Move(Game.MousePosition);
                                Utils.Sleep(100, "Ability.Move");
                                break;
                            case 2:
                                if (!Utils.SleepCheck("Ability.Move") || target == null)
                                {
                                    return;
                                }

                                Me.Attack(target);
                                Utils.Sleep(100, "Ability.Move");
                                break;
                            case 3:
                                return;
                        }
                    }
                }
            }

            var meMissingHp = Me.MaximumHealth - Me.Health;
            var meMana = Me.Mana;
            if (Utils.SleepCheck("Orbwalk.Attack")
                && enemyHeroes.Any(
                    enemyHero => FullCombo.AutoUsage(enemyHero, enemyHeroes, meMissingHp, ping, Me, meMana)))
            {
                return;
            }

            if (Utils.SleepCheck("casting"))
            {
                if (FullCombo.KillSteal(enemyHeroes, ping, Me))
                {
                    return;
                }
            }

            if (Game.IsChatOpen)
            {
                return;
            }

            if (keyDown)
            {
                if (Utils.SleepCheck("UpdateTarget")
                    && (target == null || !target.IsValid || !target.IsAlive || (!target.IsVisible && targetLock == 0)))
                {
                    var mode =
                        MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.Target").GetValue<StringList>().SelectedIndex;
                    target = mode == 0
                                 ? TargetSelector.ClosestToMouse(Me, 2000)
                                 : EnemyHeroes.UsableHeroes.Where(x => x.Distance2D(Me) < 2000)
                                       .MaxOrDefault(x => x.GetDoableDamage());
                    Utils.Sleep(250, "UpdateTarget");
                }

                var selectedCombo = MainMenu.ComboKeysMenu.Item("abilityComboType").GetValue<StringList>().SelectedIndex;
                if (target != null && Utils.SleepCheck("Orbwalk.Attack"))
                {
                    var combo = FullCombo.Execute(
                        target, 
                        enemyHeroes, 
                        ping, 
                        selectedCombo == 2, 
                        selectedCombo == 1, 
                        Me,
                        meMana);
                }

                if (Me.ClassID == ClassID.CDOTA_Unit_Hero_TemplarAssassin && target != null && target.IsVisible)
                {
                    var meld = Me.Spellbook.SpellW;
                    if (meld.ManaCost <= meMana && meld.Cooldown >= 0 && meld.Cooldown < UnitDatabase.GetAttackRate(Me)
                        && target.Health > Dictionaries.HitDamageDictionary[target.Handle] * 2)
                    {
                        if (!Utils.SleepCheck("Ability.Move"))
                        {
                            return;
                        }

                        Me.Move(Game.MousePosition);
                        Utils.Sleep(100, "Ability.Move");
                        return;
                    }
                }

                if (Utils.SleepCheck("GlobalCasting")
                    && (Game.MousePosition.Distance2D(Me)
                        > MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.NoMoveRange").GetValue<Slider>().Value
                        || (target != null
                            && Me.Distance2D(target)
                            <= MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.NoMoveRange").GetValue<Slider>().Value)))
                {
                    var mode = MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.Mode").GetValue<StringList>().SelectedIndex;
                    switch (mode)
                    {
                        case 0:

                            Orbwalking.Orbwalk(target, attackmodifiers: true);
                            break;
                        case 1:
                            if (!Utils.SleepCheck("Ability.Move"))
                            {
                                return;
                            }

                            Me.Move(Game.MousePosition);
                            Utils.Sleep(100, "Ability.Move");
                            break;
                        case 2:
                            if (!Utils.SleepCheck("Ability.Move") || target == null)
                            {
                                return;
                            }

                            Me.Attack(target);
                            Utils.Sleep(100, "Ability.Move");
                            break;
                        case 3:
                            return;
                    }
                }
            }
        }
        private static void Game_OnUpdate(EventArgs args)
        {
            #region Init

            var me = ObjectMgr.LocalHero;
            if (!_loaded)
            {
                if (!Game.IsInGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Invoker)
                {
                    return;
                }
                _loaded = true;
                _combo = 0;

                var q = me.Spellbook.SpellQ;
                var w = me.Spellbook.SpellW;
                var e = me.Spellbook.SpellE;

                var ss = me.FindSpell("invoker_sun_strike");
                var coldsnap = me.FindSpell("invoker_cold_snap");
                var ghostwalk = me.FindSpell("invoker_ghost_walk");
                var icewall = me.FindSpell("invoker_ice_wall");
                var tornado = me.FindSpell("invoker_tornado");
                var blast = me.FindSpell("invoker_deafening_blast");
                var forge = me.FindSpell("invoker_forge_spirit");
                var emp = me.FindSpell("invoker_emp");
                var alacrity = me.FindSpell("invoker_alacrity");
                var meteor = me.FindSpell("invoker_chaos_meteor");

                SpellInfo.Add(ss.Name, new SpellStruct(e, e, e));
                SpellInfo.Add(coldsnap.Name, new SpellStruct(q, q, q));
                SpellInfo.Add(ghostwalk.Name, new SpellStruct(q, q, w));
                SpellInfo.Add(icewall.Name, new SpellStruct(q, q, e));
                SpellInfo.Add(tornado.Name, new SpellStruct(w, w, q));
                SpellInfo.Add(blast.Name, new SpellStruct(q, w, e));
                SpellInfo.Add(forge.Name, new SpellStruct(e, e, q));
                SpellInfo.Add(emp.Name, new SpellStruct(w, w, w));
                SpellInfo.Add(alacrity.Name, new SpellStruct(w, w, e));
                SpellInfo.Add(meteor.Name, new SpellStruct(e, e, w));

                Combos[0] = new ComboStruct(true, ss, meteor, blast, coldsnap, forge);
                Combos[1] = new ComboStruct(tornado, emp, meteor, blast, coldsnap);
                Combos[2] = new ComboStruct(tornado, meteor, blast, null, null);
                Combos[3] = new ComboStruct(tornado, emp, blast, null, null);
                Combos[4] = new ComboStruct(tornado, emp, icewall, null, null);
                Combos[5] = new ComboStruct(tornado, ss, icewall, null, null);

                PrintSuccess(string.Format("> Invorker Loaded v{0}", Ver));
                PrintInfo("===============Combo selection===============");
                for (var i = 0; i <= 5; i++)
                    PrintInfo(string.Format("Init new combo--> {0}", Combos[i]));
                PrintInfo("============================================");

            }

            if (!Game.IsInGame || me == null)
            {
                _loaded = false;
                PrintInfo("> Invorker unLoaded");
                return;
            }

            if (Game.IsPaused)
            {
                return;
            }
            //PrintInfo(me.NetworkActivity.ToString());
            if (Utils.SleepCheck("act") && !_inAction && _smartSphere)
            {
                var quas = me.Spellbook.SpellQ;
                var wex = me.Spellbook.SpellW;
                //if (me.NetworkActivity == NetworkActivity.Attack2 && me.NetworkActivity != LastAct)

                if ((me.NetworkActivity == NetworkActivity.Attack || me.NetworkActivity == NetworkActivity.Attack2) &&
                    me.NetworkActivity != _lastAct)
                {
                    //exort.UseAbility();
                    //exort.UseAbility();
                    //exort.UseAbility();
                    //Utils.Sleep(me.AttackSpeedValue+2000, "act");
                }
                //else if ((me.NetworkActivity == NetworkActivity.Move && me.NetworkActivity != LastAct))
                else if (me.NetworkActivity == NetworkActivity.Move && me.NetworkActivity != _lastAct && !me.IsInvisible())
                {
                    if (wex != null && wex.Level > quas.Level && wex.CanBeCasted())
                    {
                        wex.UseAbility();
                        wex.UseAbility();
                        wex.UseAbility();
                    }
                    else if (quas!=null && quas.CanBeCasted())
                    {
                        quas.UseAbility();
                        quas.UseAbility();
                        quas.UseAbility();
                    }
                }
                else if (me.NetworkActivity == NetworkActivity.Idle && me.NetworkActivity != _lastAct)
                {
                    /*quas.UseAbility();
                quas.UseAbility();
                quas.UseAbility();
                Utils.Sleep(150, "act");*/
                }
                _lastAct = me.NetworkActivity;
            }

            #endregion

            #region Get needed spells

            if (_startInitSpell && Utils.SleepCheck("GettingNeededSpells"))
            {
                _startInitSpell = false;
                InvokeNeededSpells(me);
            }

            #endregion

            #region Starting Combo

            var target = ClosestToMouse(me);
            if (_inAction && target != null && target.IsAlive)
                ComboInAction(me, target);

            #endregion
        }
示例#31
0
        private static void Game_OnUpdate(EventArgs args)
        {
            #region Init

            var me = ObjectMgr.LocalHero;
            if (!_loaded)
            {
                if (!Game.IsInGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Invoker)
                {
                    return;
                }
                _loaded = true;
                _combo = 0;

                var q = me.Spellbook.SpellQ;
                var w = me.Spellbook.SpellW;
                var e = me.Spellbook.SpellE;

                var ss = me.FindSpell("invoker_sun_strike");
                var coldsnap = me.FindSpell("invoker_cold_snap");
                var ghostwalk = me.FindSpell("invoker_ghost_walk");
                var icewall = me.FindSpell("invoker_ice_wall");
                var tornado = me.FindSpell("invoker_tornado");
                var deafblast = me.FindSpell("invoker_deafening_blast");
                var forge = me.FindSpell("invoker_forge_spirit");
                var emp = me.FindSpell("invoker_emp");
                var alacrity = me.FindSpell("invoker_alacrity");
                var chaosmeteor = me.FindSpell("invoker_chaos_meteor");

                SpellInfo.Add(ss.Name, new SpellStruct(e, e, e));
                SpellInfo.Add(coldsnap.Name, new SpellStruct(q, q, q));
                SpellInfo.Add(ghostwalk.Name, new SpellStruct(q, q, w));
                SpellInfo.Add(icewall.Name, new SpellStruct(q, q, e));
                SpellInfo.Add(tornado.Name, new SpellStruct(w, w, q));
                SpellInfo.Add(deafblast.Name, new SpellStruct(q, w, e));
                SpellInfo.Add(forge.Name, new SpellStruct(e, e, q));
                SpellInfo.Add(emp.Name, new SpellStruct(w, w, w));
                SpellInfo.Add(alacrity.Name, new SpellStruct(w, w, e));
                SpellInfo.Add(chaosmeteor.Name, new SpellStruct(e, e, w));

                /*
                Spells[Convert.ToInt32(ss.Name)] = new SpellStruct(e, e, e);
                Spells[Convert.ToInt32(coldsnap.Name)] = new SpellStruct( q, q, q);
                Spells[Convert.ToInt32(ghostwalk.Name)] = new SpellStruct( );
                Spells[Convert.ToInt32(icewall.Name)] = new SpellStruct( );
                Spells[Convert.ToInt32(tornado.Name)] = new SpellStruct();
                Spells[Convert.ToInt32(deafblast.Name)] = new SpellStruct();
                Spells[Convert.ToInt32(forge.Name)] = new SpellStruct();
                Spells[Convert.ToInt32(emp.Name)] = new SpellStruct();
                Spells[Convert.ToInt32(alacrity.Name)] = new SpellStruct();
                Spells[Convert.ToInt32(chaosmeteor.Name)] = new SpellStruct(e, e, w);
                 * */
                //Eul->SS->Met->Bla->Cold
                /*
                Tornado > EMP > Meteor > Blast (Requiers Aghanims)
                Tornado > Meteor > Blast
                Tornado > EMP > Blast
                Tornado > EMP > Ica Wall
                 */
                //Combos[0] = new ComboStruct(true, ss, chaosmeteor, deafblast, null, null);
                Combos[0] = new ComboStruct(true, ss, chaosmeteor, deafblast, coldsnap, forge);
                Combos[1] = new ComboStruct(tornado, emp, chaosmeteor, deafblast, coldsnap);
                Combos[2] = new ComboStruct(tornado, chaosmeteor, deafblast, null, null);
                Combos[3] = new ComboStruct(tornado, emp, deafblast, null, null);
                Combos[4] = new ComboStruct(tornado, emp, icewall, null, null);
                Combos[5] = new ComboStruct(tornado, ss, icewall, null, null);
                PrintSuccess(string.Format("> Invorker Loaded v{0}", Ver));
                PrintInfo("===============Combo selection===============");
                PrintInfo(string.Format("Init new combo--> {0}", Combos[0]));
                PrintInfo(string.Format("Init new combo--> {0}", Combos[1]));
                PrintInfo(string.Format("Init new combo--> {0}", Combos[2]));
                PrintInfo(string.Format("Init new combo--> {0}", Combos[3]));
                PrintInfo(string.Format("Init new combo--> {0}", Combos[4]));
                PrintInfo(string.Format("Init new combo--> {0}", Combos[5]));
                PrintInfo("============================================");

            }

            if (!Game.IsInGame || me == null)
            {
                _loaded = false;
                PrintInfo("> Invorker unLoaded");
                return;
            }

            if (Game.IsPaused)
            {
                return;
            }
            //PrintInfo(me.NetworkActivity.ToString());
            if (Utils.SleepCheck("act") && !_inAction && _smartSphere)
            {
                var quas = me.Spellbook.SpellQ;
                var wex = me.Spellbook.SpellW;
                var exort = me.Spellbook.SpellE;
                //if (me.NetworkActivity == NetworkActivity.Attack2 && me.NetworkActivity != LastAct)

                if ((me.NetworkActivity == NetworkActivity.Attack || me.NetworkActivity == NetworkActivity.Attack2) &&
                    me.NetworkActivity != _lastAct)
                {
                    //exort.UseAbility();
                    //exort.UseAbility();
                    //exort.UseAbility();
                    //Utils.Sleep(me.AttackSpeedValue+2000, "act");
                }
                //else if ((me.NetworkActivity == NetworkActivity.Move && me.NetworkActivity != LastAct))
                else if (me.NetworkActivity == NetworkActivity.Move && me.NetworkActivity != _lastAct && !me.IsInvisible())
                {
                    if (wex != null && wex.Level > quas.Level && wex.CanBeCasted())
                    {
                        wex.UseAbility();
                        wex.UseAbility();
                        wex.UseAbility();
                    }
                    else if (quas!=null && quas.CanBeCasted())
                    {
                        quas.UseAbility();
                        quas.UseAbility();
                        quas.UseAbility();
                    }
                }
                else if (me.NetworkActivity == NetworkActivity.Idle && me.NetworkActivity != _lastAct)
                {
                    /*quas.UseAbility();
                quas.UseAbility();
                quas.UseAbility();
                Utils.Sleep(150, "act");*/
                }
                _lastAct = me.NetworkActivity;
            }

            #endregion

            #region Get needed spells

            if (_startInitSpell && Utils.SleepCheck("GettingNeededSpells"))
            {
                _startInitSpell = false;
                SpellStruct s;
                var spell1 = _spellForCast = Combos[_combo].GetComboAbilities()[0];
                var spell2 = _spellForCast = Combos[_combo].GetComboAbilities()[1];
                var active1 = me.Spellbook.Spell4;
                var active2 = me.Spellbook.Spell5;
                if (Equals(spell1, active1) || Equals(spell1, active2))
                {

                }
                else
                {
                    if (SpellInfo.TryGetValue(spell1.Name, out s))
                    {
                        var invoke = me.FindSpell("invoker_invoke");
                        if (invoke.CanBeCasted())
                        {
                            var spells = s.GetNeededAbilities();
                            if (spells[0] != null) spells[0].UseAbility();
                            if (spells[1] != null) spells[1].UseAbility();
                            if (spells[2] != null) spells[2].UseAbility();
                            invoke.UseAbility();
                            Utils.Sleep(Game.Ping + 25, "GettingNeededSpells");
                        }
                    }
                    else
                        try
                        {
                            PrintError("couldnt find data for spell: " + _spellForCast.Name);
                        }
                        catch (Exception)
                        {
                            PrintError("couldnt find data for spell: ERROR");
                        }
                }
                if (Equals(spell2, active1) || Equals(spell2, active2))
                {

                }
                else
                {
                    if (SpellInfo.TryGetValue(spell2.Name, out s))
                    {
                        var invoke = me.FindSpell("invoker_invoke");
                        if (invoke.CanBeCasted())
                        {
                            var spells = s.GetNeededAbilities();
                            if (spells[0] != null) spells[0].UseAbility();
                            if (spells[1] != null) spells[1].UseAbility();
                            if (spells[2] != null) spells[2].UseAbility();
                            invoke.UseAbility();
                            Utils.Sleep(Game.Ping + 25, "GettingNeededSpells");
                        }
                    }
                    else
                        try
                        {
                            PrintError("couldnt find data for spell: " + _spellForCast.Name);
                        }
                        catch (Exception)
                        {
                            PrintError("couldnt find data for spell: ERROR");
                        }
                }
            }

            #endregion

            #region Starting Combo

            var target = ClosestToMouse(me);
            if (_inAction && target != null && target.IsAlive)
                ComboInAction(me, target);

            #endregion
        }
示例#32
0
        private static void Game_OnUpdate(EventArgs args)
        {
            if (me == null)
            {
                me = ObjectMgr.LocalHero;
            }
            if (!Game.IsInGame || me == null || Game.IsPaused)
            {
                if (Game.IsInGame && me != null)
                {
                    return;
                }
                LastAttackStart = 0;
                lastActivity = 0;
                me = null;
                return;
            }
            //Console.WriteLine("a");
            tick = Environment.TickCount;
            if (me.NetworkActivity == lastActivity)
            {
                return;
            }
            lastActivity = me.NetworkActivity;
            //Console.WriteLine(lastActivity);
            if (!me.IsAttacking())
            {
                return;
            }

            //if (orbwalkTarget != null)
            //{
            //    LastAttackStart = (float)(tick + me.GetTurnTime(orbwalkTarget) * 1000);
            //}
            //else
            //{
            LastAttackStart = tick;
            // }
        }
示例#33
0
 public AttackObject(Unit instance, NetworkActivity state = NetworkActivity.Idle, long tick = 0)
 {
     this.Instance = instance;
     this.State = state;
     this.Created = tick > 0 ? tick : Environment.TickCount;
 }
        /// <summary>
        ///     The entity_ on int 32 property change.
        /// </summary>
        /// <param name="sender">
        ///     The sender.
        /// </param>
        /// <param name="args">
        ///     The args.
        /// </param>
        private void Entity_OnInt32PropertyChange(Entity sender, Int32PropertyChangeEventArgs args)
        {
            if (!sender.Equals(this.Unit) || args.PropertyName != "m_NetworkActivity")
            {
                return;
            }

            if (this.Unit == null || !this.Unit.IsValid)
            {
                Entity.OnInt32PropertyChange -= this.Entity_OnInt32PropertyChange;
                return;
            }

            if (!Game.IsInGame || Game.IsPaused)
            {
                return;
            }

            var newValue = (NetworkActivity)args.NewValue;
            var oldValue = (NetworkActivity)args.OldValue;
            if (newValue == this.lastUnitActivity || newValue == oldValue)
            {
                return;
            }

            var canCancel = this.CanCancelAttack();
            var wasAttacking = false;
            if (!this.IsAttackOnCoolDown() || canCancel)
            {
                wasAttacking = this.isAttacking;
                this.lastUnitActivity = newValue;
                this.isAttacking = newValue == NetworkActivity.Attack || newValue == NetworkActivity.Crit
                                   || newValue == NetworkActivity.Attack2 || newValue == NetworkActivity.AttackEvent
                                   || newValue == NetworkActivity.AttackEventBash
                                   || newValue == NetworkActivity.EarthshakerTotemAttack;
            }

            if (wasAttacking && canCancel && !this.isAttacking
                && (oldValue == NetworkActivity.Attack || oldValue == NetworkActivity.Crit
                    || oldValue == NetworkActivity.Attack2 || oldValue == NetworkActivity.AttackEvent
                    || oldValue == NetworkActivity.AttackEventBash || oldValue == NetworkActivity.EarthshakerTotemAttack))
            {
                this.AttackEnd();
            }

            if (!this.isAttacking || (!this.isAttacking && !canCancel))
            {
                return;
            }

            this.LastUnitAttackStart = Game.RawGameTime;
            this.NextUnitAttackEnd =
                (float)(this.LastUnitAttackStart * 1000 + UnitDatabase.GetAttackRate(this.Unit) * 1000);
            this.NextUnitAttackRelease =
                (float)(this.LastUnitAttackStart * 1000 + UnitDatabase.GetAttackPoint(this.Unit) * 1000);
            this.AttackOrderSent = false;
            this.AttackStart();
        }
示例#35
0
 public CounterHelp(ClassID hero, string strKey = "", int intKey = 0,
     NetworkActivity activity = 0, string modifer = "")
     : this()
 {
     Hero = hero;
     Modifer = modifer;
     Activity = activity;
     IntKey = intKey;
     StrKey = strKey;
 }
示例#36
0
        private static void Events_OnLoad(object sender, EventArgs e)
        {
            if (loaded)
            {
                return;
            }

            Drawing.OnDraw += Game_OnUpdate;
            LastAttackStart = 0;
            lastActivity = 0;
            me = null;
            loaded = true;
        }
示例#37
0
        private static void Events_OnClose(object sender, EventArgs e)
        {
            if (!loaded)
            {
                return;
            }

            Drawing.OnDraw -= Game_OnUpdate;
            LastAttackStart = 0;
            lastActivity = 0;
            me = null;
            loaded = false;
        }
示例#38
0
        private static void Game_OnUpdate(EventArgs args)
        {
            #region Init

            var me = ObjectMgr.LocalHero;
            if (!_loaded)
            {
                if (!Game.IsInGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Invoker)
                {
                    return;
                }
                _loaded = true;
                _combo  = 0;


                var q = me.Spellbook.SpellQ;
                var w = me.Spellbook.SpellW;
                var e = me.Spellbook.SpellE;

                var ss          = me.FindSpell("invoker_sun_strike");
                var coldsnap    = me.FindSpell("invoker_cold_snap");
                var ghostwalk   = me.FindSpell("invoker_ghost_walk");
                var icewall     = me.FindSpell("invoker_ice_wall");
                var tornado     = me.FindSpell("invoker_tornado");
                var blast       = me.FindSpell("invoker_deafening_blast");
                var forgeSpirit = me.FindSpell("invoker_forge_spirit");
                var emp         = me.FindSpell("invoker_emp");
                var alacrity    = me.FindSpell("invoker_alacrity");
                var meteor      = me.FindSpell("invoker_chaos_meteor");

                SpellInfo.Add(ss.Name, new SpellStruct(e, e, e));
                SpellInfo.Add(coldsnap.Name, new SpellStruct(q, q, q));
                SpellInfo.Add(ghostwalk.Name, new SpellStruct(q, q, w));
                SpellInfo.Add(icewall.Name, new SpellStruct(q, q, e));
                SpellInfo.Add(tornado.Name, new SpellStruct(w, w, q));
                SpellInfo.Add(blast.Name, new SpellStruct(q, w, e));
                SpellInfo.Add(forgeSpirit.Name, new SpellStruct(e, e, q));
                SpellInfo.Add(emp.Name, new SpellStruct(w, w, w));
                SpellInfo.Add(alacrity.Name, new SpellStruct(w, w, e));
                SpellInfo.Add(meteor.Name, new SpellStruct(e, e, w));

                Combos[_maxCombo] = new ComboStruct(new[] { ss, meteor, blast, coldsnap, forgeSpirit }, 5, true);
                Combos[_maxCombo] =
                    new ComboStruct(new[] { tornado, ss, meteor, blast, tornado, coldsnap, alacrity, forgeSpirit }, 5);
                Combos[_maxCombo] = new ComboStruct(new[] { tornado, emp, ss, meteor, blast, tornado, coldsnap }, 5);
                Combos[_maxCombo] = new ComboStruct(new[] { tornado, emp, meteor, blast, coldsnap }, 5);
                Combos[_maxCombo] = new ComboStruct(new[] { tornado, meteor, blast }, 3);
                Combos[_maxCombo] = new ComboStruct(new[] { tornado, emp, blast }, 3);
                Combos[_maxCombo] = new ComboStruct(new[] { tornado, emp, icewall }, 3);
                Combos[_maxCombo] = new ComboStruct(new[] { tornado, ss, icewall }, 3);
                Combos[_maxCombo] = new ComboStruct(new[] { tornado, blast, coldsnap }, 3);
                Combos[_maxCombo] = new ComboStruct(new[] { tornado, emp, coldsnap }, 3);
                Combos[_maxCombo] = new ComboStruct(new[] { coldsnap, alacrity, forgeSpirit }, 3);
                Combos[_maxCombo] = new ComboStruct(new[] { tornado, emp, meteor, blast, ss, icewall }, 5);

                Game.PrintMessage(
                    "<font face='Comic Sans MS, cursive'><font color='#00aaff'>" + Menu.DisplayName + " By Jumpering" +
                    " loaded!</font> <font color='#aa0000'>v" + Ver, MessageType.LogMessage);
                PrintSuccess(string.Format("> {1} Loaded v{0}", Ver, Menu.DisplayName));

                /*PrintInfo("===============Combo selection===============");
                 * for (var i = 0; i < _maxCombo; i++)
                 *  PrintInfo(string.Format("Init new combo--> {0}", Combos[i]));
                 * PrintInfo("============================================");*/
            }

            if (!Game.IsInGame || me == null)
            {
                _loaded = false;
                PrintInfo("> Invorker Annihilation unLoaded");
                return;
            }

            if (Game.IsPaused)
            {
                return;
            }
            //PrintInfo(me.NetworkActivity.ToString());
            if (Utils.SleepCheck("act") && !_inAction && Menu.Item("smartIsActive").GetValue <bool>())
            {
                Ability spell = null;
                switch (Menu.Item("OnMoving").GetValue <StringList>().SelectedIndex)
                {
                case (int)SmartSphereEnum.Quas:
                    spell = me.Spellbook.SpellQ;
                    break;

                case (int)SmartSphereEnum.Wex:
                    spell = me.Spellbook.SpellW;
                    break;
                }
                if (me.NetworkActivity == NetworkActivity.Move && me.NetworkActivity != _lastAct && !me.IsInvisible())
                {
                    if (spell != null && spell.CanBeCasted())
                    {
                        spell.UseAbility();
                        spell.UseAbility();
                        spell.UseAbility();
                    }
                }
                _lastAct = me.NetworkActivity;
            }

            #endregion

            #region Get needed spells

            if (_startInitSpell && Utils.SleepCheck("GettingNeededSpells"))
            {
                _startInitSpell = false;
                InvokeNeededSpells(me);
            }

            #endregion

            #region Starting Combo

            if (!_inAction)
            {
                _globalTarget = null;
                return;
            }
            if (_globalTarget == null || !_globalTarget.IsValid)
            {
                _globalTarget = ClosestToMouse(me);
            }
            if (_globalTarget == null || !_globalTarget.IsValid || !_globalTarget.IsAlive || !me.CanCast())
            {
                return;
            }

            ComboInAction(me, _globalTarget);

            /*
             * var target = ClosestToMouse(me);
             * if (_ssprediction || _showsSsDamage || _sunstrikekill)
             * {
             *  _globalTarget = target;
             * }
             * else
             * {
             *  if (_predictionEffect != null)
             *  {
             *      _predictionEffect.Dispose();
             *      _predictionEffect = null;
             *  }
             * }
             * if (_inAction && target != null && target.IsAlive)
             *  ComboInAction(me, target);
             */
            #endregion
        }
示例#39
0
 public void PopNetworkActive()
 {
     NetworkActivity.PopNetworkActive();
 }
示例#40
0
 /// <summary>
 ///     Loads orbwalking if its not loaded yet
 /// </summary>
 public static void Load()
 {
     if (loaded)
     {
         return;
     }
     Game.OnUpdate += Game_OnUpdate;
     LastAttackStart = 0;
     lastActivity = 0;
     me = null;
     loaded = true;
 }
示例#41
0
 public CounterHelp(ClassID hero, string strKey = "", int intKey = 0, float extraRange = 0,
     NetworkActivity activity = 0, string modifer = "")
     : this()
 {
     _hero = hero;
     _modifer = modifer;
     _activity = activity;
     _intKey = intKey;
     _strKey = strKey;
     _extraRange = extraRange;
 }
示例#42
0
        private static void Game_OnUpdate(EventArgs args)
        {
            #region Init

            var me = ObjectMgr.LocalHero;
            if (!_loaded)
            {
                if (!Game.IsInGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Invoker)
                {
                    return;
                }
                _loaded = true;
                _combo  = 0;


                var q = me.Spellbook.SpellQ;
                var w = me.Spellbook.SpellW;
                var e = me.Spellbook.SpellE;

                var ss          = me.FindSpell("invoker_sun_strike");
                var coldsnap    = me.FindSpell("invoker_cold_snap");
                var ghostwalk   = me.FindSpell("invoker_ghost_walk");
                var icewall     = me.FindSpell("invoker_ice_wall");
                var tornado     = me.FindSpell("invoker_tornado");
                var deafblast   = me.FindSpell("invoker_deafening_blast");
                var forge       = me.FindSpell("invoker_forge_spirit");
                var emp         = me.FindSpell("invoker_emp");
                var alacrity    = me.FindSpell("invoker_alacrity");
                var chaosmeteor = me.FindSpell("invoker_chaos_meteor");

                SpellInfo.Add(ss.Name, new SpellStruct(e, e, e));
                SpellInfo.Add(coldsnap.Name, new SpellStruct(q, q, q));
                SpellInfo.Add(ghostwalk.Name, new SpellStruct(q, q, w));
                SpellInfo.Add(icewall.Name, new SpellStruct(q, q, e));
                SpellInfo.Add(tornado.Name, new SpellStruct(w, w, q));
                SpellInfo.Add(deafblast.Name, new SpellStruct(q, w, e));
                SpellInfo.Add(forge.Name, new SpellStruct(e, e, q));
                SpellInfo.Add(emp.Name, new SpellStruct(w, w, w));
                SpellInfo.Add(alacrity.Name, new SpellStruct(w, w, e));
                SpellInfo.Add(chaosmeteor.Name, new SpellStruct(e, e, w));

                /*
                 * Spells[Convert.ToInt32(ss.Name)] = new SpellStruct(e, e, e);
                 * Spells[Convert.ToInt32(coldsnap.Name)] = new SpellStruct( q, q, q);
                 * Spells[Convert.ToInt32(ghostwalk.Name)] = new SpellStruct( );
                 * Spells[Convert.ToInt32(icewall.Name)] = new SpellStruct( );
                 * Spells[Convert.ToInt32(tornado.Name)] = new SpellStruct();
                 * Spells[Convert.ToInt32(deafblast.Name)] = new SpellStruct();
                 * Spells[Convert.ToInt32(forge.Name)] = new SpellStruct();
                 * Spells[Convert.ToInt32(emp.Name)] = new SpellStruct();
                 * Spells[Convert.ToInt32(alacrity.Name)] = new SpellStruct();
                 * Spells[Convert.ToInt32(chaosmeteor.Name)] = new SpellStruct(e, e, w);
                 * */
                //Eul->SS->Met->Bla->Cold

                /*
                 * Tornado > EMP > Meteor > Blast (Requiers Aghanims)
                 * Tornado > Meteor > Blast
                 * Tornado > EMP > Blast
                 * Tornado > EMP > Ica Wall
                 */
                //Combos[0] = new ComboStruct(true, ss, chaosmeteor, deafblast, null, null);
                Combos[0] = new ComboStruct(true, ss, chaosmeteor, deafblast, coldsnap, forge);
                Combos[1] = new ComboStruct(tornado, emp, chaosmeteor, deafblast, coldsnap);
                Combos[2] = new ComboStruct(tornado, chaosmeteor, deafblast, null, null);
                Combos[3] = new ComboStruct(tornado, emp, deafblast, null, null);
                Combos[4] = new ComboStruct(tornado, emp, icewall, null, null);
                PrintSuccess(string.Format("> Invorker Loaded v{0}", Ver));
                PrintInfo("===============Combo selection===============");
                PrintInfo(string.Format("Init new combo--> {0}", Combos[0]));
                PrintInfo(string.Format("Init new combo--> {0}", Combos[1]));
                PrintInfo(string.Format("Init new combo--> {0}", Combos[2]));
                PrintInfo(string.Format("Init new combo--> {0}", Combos[3]));
                PrintInfo(string.Format("Init new combo--> {0}", Combos[4]));
                PrintInfo("============================================");
            }

            if (!Game.IsInGame || me == null)
            {
                _loaded = false;
                PrintInfo("> Invorker unLoaded");
                return;
            }

            if (Game.IsPaused)
            {
                return;
            }
            //PrintInfo(me.NetworkActivity.ToString());
            if (Utils.SleepCheck("act") && !_inAction && SmartSphere)
            {
                var quas  = me.Spellbook.SpellQ;
                var wex   = me.Spellbook.SpellW;
                var exort = me.Spellbook.SpellE;
                if (wex != null && wex.CanBeCasted())
                {
                    //if (me.NetworkActivity == NetworkActivity.Attack2 && me.NetworkActivity != LastAct)

                    if ((me.NetworkActivity == NetworkActivity.Attack || me.NetworkActivity == NetworkActivity.Attack2) &&
                        me.NetworkActivity != LastAct)
                    {
                        //exort.UseAbility();
                        //exort.UseAbility();
                        //exort.UseAbility();
                        //Utils.Sleep(me.AttackSpeedValue+2000, "act");
                    }
                    //else if ((me.NetworkActivity == NetworkActivity.Move && me.NetworkActivity != LastAct))
                    else if (me.NetworkActivity == NetworkActivity.Move && me.NetworkActivity != LastAct)
                    {
                        wex.UseAbility();
                        wex.UseAbility();
                        wex.UseAbility();
                    }
                    else if (me.NetworkActivity == NetworkActivity.Idle && me.NetworkActivity != LastAct)
                    {
                        /*quas.UseAbility();
                         * quas.UseAbility();
                         * quas.UseAbility();
                         * Utils.Sleep(150, "act");*/
                    }
                    LastAct = me.NetworkActivity;
                }
            }

            #endregion

            #region Get needed spells

            if (_startInitSpell && Utils.SleepCheck("GettingNeededSpells"))
            {
                _startInitSpell = false;
                SpellStruct s;
                var         spell1  = _spellForCast = Combos[_combo].GetComboAbilities()[0];
                var         spell2  = _spellForCast = Combos[_combo].GetComboAbilities()[1];
                var         active1 = me.Spellbook.Spell4;
                var         active2 = me.Spellbook.Spell5;
                if (Equals(spell1, active1) || Equals(spell1, active2))
                {
                }
                else
                {
                    if (SpellInfo.TryGetValue(spell1.Name, out s))
                    {
                        var invoke = me.FindSpell("invoker_invoke");
                        if (invoke.CanBeCasted())
                        {
                            var spells = s.GetNeededAbilities();
                            if (spells[0] != null)
                            {
                                spells[0].UseAbility();
                            }
                            if (spells[1] != null)
                            {
                                spells[1].UseAbility();
                            }
                            if (spells[2] != null)
                            {
                                spells[2].UseAbility();
                            }
                            invoke.UseAbility();
                            Utils.Sleep(Game.Ping + 25, "GettingNeededSpells");
                        }
                    }
                    else
                    {
                        try
                        {
                            PrintError("couldnt find data for spell: " + _spellForCast.Name);
                        }
                        catch (Exception)
                        {
                            PrintError("couldnt find data for spell: ERROR");
                        }
                    }
                }
                if (Equals(spell2, active1) || Equals(spell2, active2))
                {
                }
                else
                {
                    if (SpellInfo.TryGetValue(spell2.Name, out s))
                    {
                        var invoke = me.FindSpell("invoker_invoke");
                        if (invoke.CanBeCasted())
                        {
                            var spells = s.GetNeededAbilities();
                            if (spells[0] != null)
                            {
                                spells[0].UseAbility();
                            }
                            if (spells[1] != null)
                            {
                                spells[1].UseAbility();
                            }
                            if (spells[2] != null)
                            {
                                spells[2].UseAbility();
                            }
                            invoke.UseAbility();
                            Utils.Sleep(Game.Ping + 25, "GettingNeededSpells");
                        }
                    }
                    else
                    {
                        try
                        {
                            PrintError("couldnt find data for spell: " + _spellForCast.Name);
                        }
                        catch (Exception)
                        {
                            PrintError("couldnt find data for spell: ERROR");
                        }
                    }
                }
            }

            #endregion

            #region Starting Combo

            var target = ClosestToMouse(me);
            if (_inAction && target != null && target.IsAlive)
            {
                ComboInAction(me, target);
            }

            #endregion
        }
示例#43
0
        private static void Game_OnUpdate(EventArgs args)
        {
            #region Init

            var me = _myHero;

            if (Game.IsPaused)
            {
                return;
            }

            if (Eul == null || !Eul.IsValid)
            {
                Eul = me.FindItem("item_cyclone",true);
                if (Eul != null && Eul.IsValid)
                    SpellInfo.Add(Eul.Name,new SpellStruct());
            }

            if (Utils.SleepCheck("act") && !_inAction && Menu.Item("smartIsActive").GetValue<bool>())
            {
                Ability spell = null;
                switch (Menu.Item("OnMoving").GetValue<StringList>().SelectedIndex)
                {
                    case (int) SmartSphereEnum.Quas:
                        spell = Abilities.FindAbility("invoker_quas");
                        break;
                    case (int) SmartSphereEnum.Wex:
                        spell = Abilities.FindAbility("invoker_wex");
                        break;
                }
                if (me.NetworkActivity == NetworkActivity.Move && me.NetworkActivity != _lastAct && !me.IsInvisible())
                {
                    if (spell != null && spell.CanBeCasted())
                    {
                        spell.UseAbility();
                        spell.UseAbility();
                        spell.UseAbility();
                    }
                }
                _lastAct = me.NetworkActivity;
            }

            #endregion

            #region Flee mode
            if (_ghostMode && Utils.SleepCheck("flee_mode") && !me.IsInvisible())
            {
                var q = Abilities.FindAbility("invoker_quas");
                var w = Abilities.FindAbility("invoker_wex");
                var active1 = me.Spellbook.Spell4;
                var active2 = me.Spellbook.Spell5;

                if (q?.Level > 0 && w?.Level > 0)
                {
                    var ghostwalk = Abilities.FindAbility("invoker_ghost_walk");
                    if (ghostwalk == null || ghostwalk.Cooldown > 0) return;
                    if (active1.Equals(ghostwalk) || active2.Equals(ghostwalk))
                    {
                        w.UseAbility();
                        w.UseAbility();
                        w.UseAbility();
                        ghostwalk.UseAbility();
                        Utils.Sleep(500, "flee_mode");
                    }
                    else
                    {
                        InvokeNeededSpells(me, ghostwalk);
                        w.UseAbility();
                        w.UseAbility();
                        w.UseAbility();
                        ghostwalk.UseAbility();
                        Utils.Sleep(500, "flee_mode");
                    }
                }
            }

            #endregion

            #region AutoInvis
            if (AutoInvis && Utils.SleepCheck("flee_mode") && !me.IsInvisible() && me.Health/me.MaximumHealth*100<=MinHealth)
            {
                CastAutoInvis(me);

            }

            #endregion

            #region QuickCast

            DoQCast();
            #endregion

            #region Auto ss on stunned enemy

            if (Menu.Item("ssAutoInStunned").GetValue<bool>() && !me.IsInvisible() && Utils.SleepCheck("auto_ss") && _globalTarget==null)
            {
                var ss = Abilities.FindAbility("invoker_sun_strike");
                if (ss != null && ss.AbilityState==AbilityState.Ready)
                {
                    var validHeroes =
                        Heroes.GetByTeam(_myHero.GetEnemyTeam()).Where(x => x.IsValid && x.IsAlive && x.IsVisible).ToList();
                    var damage = !Menu.Item("ssAutoInStunned.KillSteal").GetValue<bool>()
                        ? 100 +
                          62.5*
                          (Abilities.FindAbility("invoker_exort").Level - 1 + (_myHero.AghanimState() ? 1 : 0))
                        : 0;
                    var enemy =
                        validHeroes
                            .Where(
                                x => CheckForRange(x) && CheckForKillSteal(x,damage));
                    //Print(enemy.Count().ToString()+" Damage: "+damage);
                    foreach (var hero in enemy)
                    {
                        float time;
                        Vector3 extraPos;
                        if (hero.IsStunned(out time))
                        {
                            //hero.Modifiers.ForEach(modifier => Print(modifier.Name+". Time: "+modifier.RemainingTime));
                            var mod =
                                hero.HasModifiers(new[]
                                {
                                    "modifier_obsidian_destroyer_astral_imprisonment_prison", "modifier_eul_cyclone",
                                    "modifier_shadow_demon_disruption", "modifier_invoker_tornado"
                                }, false);
                            var ignoreMod = hero.HasModifiers(new[] {"modifier_invoker_cold_snap"});
                            if (((Math.Abs(time) >= 1.7 + Game.Ping/1000 && !mod) ||
                                    (Math.Abs(time) <= 1.699 + Game.Ping/1000 &&
                                    Math.Abs(time) >= 1.20 + Game.Ping/1000)) && !ignoreMod)
                            {
                                var spells = me.Spellbook;
                                var e = spells.SpellE;
                                var active1 = me.Spellbook.Spell4;
                                var active2 = me.Spellbook.Spell5;
                                if (CheckForAnyShitInRange(hero, validHeroes, out extraPos) || !extraPos.IsZero)
                                {
                                    //Print(extraPos.IsZero.ToString());
                                    var ssPos = hero.Position;
                                    if (!extraPos.IsZero)
                                        ssPos = extraPos;
                                    if (e?.Level > 0)
                                    {
                                        if (active1.Equals(ss) || active2.Equals(ss))
                                        {
                                            ss.UseAbility(ssPos);
                                            Utils.Sleep(500, "auto_ss");
                                        }
                                        else
                                        {
                                            InvokeNeededSpells(me, ss);
                                            ss.UseAbility(ssPos);
                                            Utils.Sleep(500, "auto_ss");
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            //hero.Modifiers.ForEach(modifier => Print("2. "+modifier.Name));
                            var extramod = hero.FindModifier("modifier_ember_spirit_searing_chains")??hero.FindModifier("modifier_axe_berserkers_call");
                            if (extramod != null && extramod.RemainingTime >= 1.7 + Game.Ping/1000)
                            {
                                var spells = me.Spellbook;
                                var e = spells.SpellE;
                                var active1 = me.Spellbook.Spell4;
                                var active2 = me.Spellbook.Spell5;
                                if (CheckForAnyShitInRange(hero, validHeroes, out extraPos) || !extraPos.IsZero)
                                {
                                    //Print(extraPos.IsZero.ToString());
                                    var ssPos = hero.Position;
                                    if (!extraPos.IsZero)
                                        ssPos = extraPos;
                                    if (e?.Level > 0)
                                    {
                                        if (active1.Equals(ss) || active2.Equals(ss))
                                        {
                                            ss.UseAbility(ssPos);
                                            Utils.Sleep(500, "auto_ss");
                                        }
                                        else
                                        {
                                            InvokeNeededSpells(me, ss);
                                            ss.UseAbility(ssPos);
                                            Utils.Sleep(500, "auto_ss");
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            #endregion

            #region Get needed spells

            if (_startInitSpell && Utils.SleepCheck("GettingNeededSpells"))
            {
                _startInitSpell = false;
                InvokeNeededSpells(me);
            }

            #endregion

            #region Starting Combo

            if (!_inAction)
            {
                if (_globalTarget!=null && _globalTarget.IsValid)
                    if (ComboSwitcher)
                        _combo = _startComboPosition;
                _globalTarget = null;
                return;
            }
            if (_globalTarget == null || !_globalTarget.IsValid)
            {
                _globalTarget = ClosestToMouse(me);
            }
            if (_globalTarget == null || !_globalTarget.IsValid || !_globalTarget.IsAlive || !me.CanCast()) return;

            ComboInAction(me, _globalTarget);
            /*
            var target = ClosestToMouse(me);
            if (_ssprediction || _showsSsDamage || _sunstrikekill)
            {
                _globalTarget = target;
            }
            else
            {
                if (_predictionEffect != null)
                {
                    _predictionEffect.Dispose();
                    _predictionEffect = null;
                }
            }
            if (_inAction && target != null && target.IsAlive)
                ComboInAction(me, target);
            */
            #endregion
        }