コード例 #1
0
ファイル: Program.cs プロジェクト: dendimonster/EnsageSharp-1
        private static void Game_OnUpdate(EventArgs args)
        {
            var me = ObjectMgr.LocalHero;
            if (!_loaded)
            {
                if (!Game.IsInGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Windrunner)
                {
                    return;
                }
                _loaded = true;

                PrintSuccess(string.Format("> WindRunner Annihilation Loaded v{0}", Ver));
            }
            if (!Game.IsInGame || me == null)
            {
                _loaded = false;
                PrintInfo("> WindRunner unLoaded");
                return;
            }
            try
            {
                foreach (var f in EffectMaster.ToList())
                {
                    var hero = f.Key;
                    var dick = f.Value;
                    var mainTarget = dick.MaintTarget;
                    if (!hero.IsValid || !mainTarget.IsValid) EffectMaster.Remove(f.Key);
                    var angle = (float)(Math.Max(
                            Math.Abs(me.FindAngleBetween(hero.Position, true) - (me.FindAngleBetween(mainTarget.Position, true))) - .19, 0));
                    // ReSharper disable once CompareOfFloatsByEqualityOperator
                    if (angle != 0 || me.Distance2D(mainTarget) <= me.Distance2D(hero) || !hero.IsAlive || !mainTarget.IsAlive)
                    {
                        if (dick.Effect != null)
                            dick.Effect.Dispose();
                        EffectMaster.Remove(f.Key);
                    }
                    else if (Utils.SleepCheck("cd " + dick.Effect.GetHashCode()))
                    {

                        EffectMaster.Remove(f.Key);
                        var eff = new ParticleEffect(WrEffect, hero, ParticleAttachment.WorldOrigin);
                        Utils.Sleep(500, "cd " + eff.GetHashCode());
                        //dick.Effect.Restart();
                        EffectMaster.Add(hero, new ParticleMasterOnTimer(mainTarget, eff));
                    }
                }
            }
            catch (Exception)
            {
                PrintError("error #2");
            }
            
            var shackleshot = me.Spellbook.Spell1;
            if (_shackleshotHelperWithEffects)
            {
                try
                {
                    var effectTarget = ClosestToMouse(me, 500);
                    if (effectTarget != null && effectTarget.IsValidTarget())
                        FindBestPosition(me, effectTarget, shackleshot, true);
                }
                catch (Exception)
                {
                    
                    PrintError("error #1");
                }
                
            }
            if (!_enabled)
            {
                if (_bestPosEff != null)
                    _bestPosEff.Dispose();
                return;
            }
            if (!Utils.SleepCheck("Dadzger") || !me.IsAlive)
                return;
            if (_globalTarget == null)
            {
                _globalTarget = ClosestToMouse(me, 500);
            }
            if (_globalTarget == null || !_globalTarget.IsValid || !_globalTarget.IsAlive || !me.CanCast()) return;

            var dagger = me.FindItem("item_blink");
            //var forsestaff = me.FindItem("item_force_staff");
            
            var ultimate = me.Spellbook.Spell4;
            if (_globalTarget == null) return;
            //PrintInfo("target: "+target.Name);
            var bestposition = FindBestPosition(me, _globalTarget,shackleshot);
            //ASD = bestposition;
            if (!bestposition.IsZero)
            {
                if (_bestPosEff == null || _bestPosEff.IsDestroyed)
                    _bestPosEff = new ParticleEffect(@"particles\ui_mouseactions\range_display.vpcf", bestposition);
                _bestPosEff.SetControlPoint(1, new Vector3(50, 0, 0));
                _bestPosEff.SetControlPoint(0, bestposition);
            }
            else
            {
                if (_bestPosEff != null)
                    _bestPosEff.Dispose();
            }
            if (!shackleshot.CanBeCasted() || bestposition.IsZero) return;
            var dist = me.Distance2D(bestposition);
            if (dist <= 1100)
            {
                if (dagger != null && dagger.CanBeCasted())
                    dagger.UseAbility(bestposition);
                //else if (dist <= 50)
                //{
                shackleshot.UseAbility(_globalTarget,true);
                if (_useultimate && ultimate != null && ultimate.CanBeCasted())
                {
                    ultimate.UseAbility(_globalTarget,true);
                }
                else
                {
                    me.Attack(_globalTarget,true);
                }
                Utils.Sleep(250, "Dadzger");
                /*}
                else
                {
                    me.Move(bestposition);
                    Utils.Sleep(250, "Dadzger");
                }*/

            }
            else if (me.CanMove() && Utils.SleepCheck("Move"))
            {
                me.Move(bestposition);
                Utils.Sleep(250, "Move");
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: tyljeff9408/Ensage
        private static void Game_OnUpdate(EventArgs args)
        {
            var me = ObjectManager.LocalHero;

            if (!_loaded)
            {
                if (!Game.IsInGame || me == null || me.ClassId != ClassId.CDOTA_Unit_Hero_Windrunner)
                {
                    return;
                }
                _loaded = true;

                PrintSuccess(string.Format("> WindRunner Annihilation Loaded v{0}", Ver));
            }
            if (!Game.IsInGame || me == null)
            {
                _loaded = false;
                PrintInfo("> WindRunner unLoaded");
                return;
            }
            try
            {
                foreach (var f in EffectMaster.ToList())
                {
                    var hero       = f.Key;
                    var dick       = f.Value;
                    var mainTarget = dick.MaintTarget;
                    if (!hero.IsValid || !mainTarget.IsValid)
                    {
                        EffectMaster.Remove(f.Key);
                    }
                    var angle = (float)(Math.Max(
                                            Math.Abs(me.FindAngleBetween(hero.Position, true) - (me.FindAngleBetween(mainTarget.Position, true))) - .19, 0));
                    // ReSharper disable once CompareOfFloatsByEqualityOperator
                    if (angle != 0 || me.Distance2D(mainTarget) <= me.Distance2D(hero) || !hero.IsAlive || !mainTarget.IsAlive)
                    {
                        if (dick.Effect != null)
                        {
                            dick.Effect.Dispose();
                        }
                        EffectMaster.Remove(f.Key);
                    }
                    else if (Utils.SleepCheck("cd " + dick.Effect.GetHashCode()))
                    {
                        EffectMaster.Remove(f.Key);
                        var eff = new ParticleEffect(WrEffect, hero, ParticleAttachment.WorldOrigin);
                        Utils.Sleep(500, "cd " + eff.GetHashCode());
                        //dick.Effect.Restart();
                        EffectMaster.Add(hero, new ParticleMasterOnTimer(mainTarget, eff));
                    }
                }
            }
            catch (Exception)
            {
                PrintError("error #2");
            }

            var shackleshot = me.Spellbook.Spell1;

            if (_shackleshotHelperWithEffects)
            {
                try
                {
                    var effectTarget = ClosestToMouse(me, 500);
                    if (effectTarget != null && effectTarget.IsValidTarget())
                    {
                        FindBestPosition(me, effectTarget, shackleshot, true);
                    }
                }
                catch (Exception)
                {
                    PrintError("error #1");
                }
            }
            if (!_enabled)
            {
                if (_bestPosEff != null)
                {
                    _bestPosEff.Dispose();
                }
                return;
            }
            if (!Utils.SleepCheck("Dadzger") || !me.IsAlive)
            {
                return;
            }
            if (_globalTarget == null)
            {
                _globalTarget = ClosestToMouse(me, 500);
            }
            if (_globalTarget == null || !_globalTarget.IsValid || !_globalTarget.IsAlive || !me.CanCast())
            {
                return;
            }

            var dagger = me.FindItem("item_blink");
            //var forsestaff = me.FindItem("item_force_staff");

            var ultimate = me.Spellbook.Spell4;

            if (_globalTarget == null)
            {
                return;
            }
            //PrintInfo("target: "+target.Name);
            var bestposition = FindBestPosition(me, _globalTarget, shackleshot);

            //ASD = bestposition;
            if (!bestposition.IsZero)
            {
                if (_bestPosEff == null || _bestPosEff.IsDestroyed)
                {
                    _bestPosEff = new ParticleEffect(@"particles\ui_mouseactions\range_display.vpcf", bestposition);
                }
                _bestPosEff.SetControlPoint(1, new Vector3(50, 0, 0));
                _bestPosEff.SetControlPoint(0, bestposition);
            }
            else
            {
                if (_bestPosEff != null)
                {
                    _bestPosEff.Dispose();
                }
            }
            if (!shackleshot.CanBeCasted() || bestposition.IsZero)
            {
                return;
            }
            var dist = me.Distance2D(bestposition);

            if (dist <= 1100)
            {
                if (dagger != null && dagger.CanBeCasted())
                {
                    dagger.UseAbility(bestposition);
                }
                //else if (dist <= 50)
                //{
                shackleshot.UseAbility(_globalTarget, true);
                if (_useultimate && ultimate != null && ultimate.CanBeCasted())
                {
                    ultimate.UseAbility(_globalTarget, true);
                }
                else
                {
                    me.Attack(_globalTarget, true);
                }
                Utils.Sleep(250, "Dadzger");

                /*}
                 * else
                 * {
                 *  me.Move(bestposition);
                 *  Utils.Sleep(250, "Dadzger");
                 * }*/
            }
            else if (me.CanMove() && Utils.SleepCheck("Move"))
            {
                me.Move(bestposition);
                Utils.Sleep(250, "Move");
            }
        }