Example #1
0
        public static bool AttackUnit(Unit unit, TimeSpan timeout)
        {
            if (Sherpa.GetBool(() => unit.Life <= 0))
            {
                return(false);
            }

            var startTime = TimeSpan.FromTicks(Environment.TickCount);


            while (Sherpa.GetBool(() => unit.Life > 0))
            {
                if (!Secondary.Use(unit))
                {
                    Primary.Use(unit);
                }

                Thread.Sleep(200);

                if (TimeSpan.FromTicks(Environment.TickCount).Subtract(startTime) > timeout)
                {
                    return(false);
                }
            }

            return(true);
        }
Example #2
0
        public static void StashItems()
        {
            UIElement stashUI = null;

            while (stashUI == null || !stashUI.Visible)
            {
                stashUI =
                    Sherpa.GetData(
                        () =>
                        UIElement.Get().Where(
                            x => x.Name.Contains("Root.NormalLayer.stash_dialog_mainPage.panel")).
                        FirstOrDefault());
            }


            foreach (
                var item in
                Sherpa.GetData(() => Me.GetContainerItems(Container.Inventory)).Where(CheckItemStash))
            {
                var i = item;
// ReSharper disable ConvertClosureToMethodGroup
                var p = i.GetItemFreeSpace(Container.Stash);
                if (p.X == -1 || p.Y == -1)
                {
                    continue;
                }
                Sherpa.PerformAction(() => i.MoveItem(Container.Stash, p.X, p.Y));
// ReSharper restore ConvertClosureToMethodGroup
                Thread.Sleep(Game.Ping * 2);
            }
        }
Example #3
0
        public static void SnagItems()
        {
            var items =
                Sherpa.GetData(
                    () =>
                    Unit.Get().Where(
                        x => x.Type == UnitType.Item && x.ItemContainer == Container.Unknown && CheckItemSnag(x)).
                    ToArray());

            while (items.Any())
            {
                var items1 = items;
                Sherpa.PerformAction(
                    () =>
                    Me.UsePower(
                        items1[0].Type == UnitType.Gizmo || items1[0].Type == UnitType.Item
                            ? SNOPowerId.Axe_Operate_Gizmo
                            : SNOPowerId.Axe_Operate_NPC, items1[0]));
                Thread.Sleep(250);
                items =
                    Sherpa.GetData(
                        () =>
                        Unit.Get().Where(
                            x => x.Type == UnitType.Item && x.ItemContainer == Container.Unknown && CheckItemSnag(x)).
                        ToArray());
            }
        }
Example #4
0
        public static void SalvageItems()
        {
            UIElement salvgUI = null;

            while (salvgUI == null || !salvgUI.Visible)
            {
                salvgUI =
                    Sherpa.GetData(
                        () =>
                        UIElement.Get().Where(
                            x => x.Name.Contains("Root.NormalLayer.vendor_dialog_mainPage.salvage_dialog")).
                        FirstOrDefault());
            }


            var items = Sherpa.GetData(() => Me.GetContainerItems(Container.Inventory).Where(CheckItemSalvage).ToArray());

            Snowshoes.Print(string.Format("Salvaging {0} items", items.Count()));
            foreach (var i in items)
            {
                Unit i1 = i;
                Sherpa.GetBool(i1.SalvageItem);
                Thread.Sleep(Game.Ping);
            }
        }
Example #5
0
        private void DumpAllUnitsToolStripMenuItemClick(object sender, EventArgs e)
        {
            var units = Sherpa.GetData(D3.Unit.Get);

            foreach (var unit in units)
            {
                PrintLine(String.Format("Unit: {0}", unit.Name));
            }
        }
Example #6
0
        public static void SellItems()
        {
            var items = Sherpa.GetData(() => Me.GetContainerItems(Container.Inventory).Where(CheckItemSell).ToArray());

            Snowshoes.Print(string.Format("Selling {0} items", items.Count()));
            foreach (var i in items)
            {
                Unit i1 = i;
                Sherpa.PerformAction(i1.SellItem);
                Thread.Sleep(Game.Ping);
            }
        }
Example #7
0
        public static void IdentifyAll()
        {
            Sherpa.PerformAction(() => UIElement.Get(0xDAECD77F9F0DCFB).Click());
            // open your inventory - necessary for identify

            Thread.Sleep(Game.Ping * 2); // eh. just in case.

            var inventory = Sherpa.GetData(() => Me.GetContainerItems(Container.Inventory));

            foreach (var item in inventory.Where(item => !item.ItemIdentified))
            {
                var item1 = item;
                Sherpa.PerformAction(() => item1.UseItem());
                Sherpa.WaitFor(() => item1.ItemIdentified);
            }
        }
Example #8
0
 public static bool SprintEverywhere(float x, float y)
 {
     if (Me.PrimaryResource < 20)
     {
         Warcry.Use();
     }
     while (Sherpa.GetDistance(x, y) > 10)
     {
         if (Sherpa.GetDistance(x, y) > 30 && Sprint.IsAvailableNow() && Sherpa.GetData(() => Me.PrimaryResource) >= 20)
         {
             Sprint.Use();
             Thread.Sleep(350);
         }
         else
         {
             Sherpa.Walk(x, y);
         }
     }
     return(true);
 }
Example #9
0
 public static bool MoveSuperFuckingFast(float x, float y)
 {
     while (Sherpa.GetDistance(x, y) > 10)
     {
         if (Sherpa.GetDistance(x, y) > 50 && Vault.IsAvailableNow() && Sherpa.GetData(() => Me.SecondaryResource) > 22)
         {
             Vault.Use(x, y);
             Thread.Sleep(350);
         }
         else if (Sherpa.GetDistance(x, y) > 30 && SmokeScreen.IsAvailableNow())
         {
             SmokeScreen.Use();
             Sherpa.Walk(x, y);
         }
         else
         {
             Sherpa.Walk(x, y);
         }
     }
     return(true);
 }
Example #10
0
 public bool Use()
 {
     return(IsAvailableNow() && Sherpa.GetBool(() => Me.UsePower(Id)));
 }
Example #11
0
 public bool Use(float x, float y)
 {
     return(IsAvailableNow() && Sherpa.GetBool(() => Me.UsePower(Id, x, y, Me.Z)));
 }
Example #12
0
 public bool Use(Unit target)
 {
     return(IsAvailableNow() && Sherpa.GetBool(() => Me.UsePower(Id, target)));
 }
Example #13
0
 public bool IsAvailableNow()
 {
     return(Sherpa.GetBool(
                () => Me.PrimaryResource >= PrimCost && Me.SecondaryResource >= SecCost && Me.IsSkillReady(Id)));
 }
Example #14
0
 public Watchdog(int delay, Sherpa caller)
     : base(delay)
 {
     _dependent = caller;
 }
Example #15
0
 public DeathMonitor(int delay, Sherpa caller)
     : base(delay)
 {
     _dependent = caller;
 }
Example #16
0
 public DeathMonitor(int delay, Sherpa caller)
     : base(delay)
 {
     _dependent = caller;
 }
Example #17
0
 public Watchdog(int delay, Sherpa caller)
     : base(delay)
 {
     _dependent = caller;
 }