Exemplo n.º 1
0
        public CbEditWpt(Waypoint waypoint)
        {
            InitializeComponent();

            this.waypoint = waypoint;

            OnLoad();
        }
Exemplo n.º 2
0
        private void DoShovel(Waypoint waypoint)
        {
            try
            {
                if (waypoint == null)
                    throw new ArgumentNullException("waypoint");

                if (!Player.Location.IsAdjacentTo(waypoint.Location)) DoStand(waypoint);
                Helpers.Debug.WriteLine("executing shovel waypoint...", ConsoleColor.Red);
                Collection<Objects.Container> containers = new Collection<Objects.Container>();
                containers = Inventory.Instance.GetContainers();

                int idfound = -1;
                Objects.Container cfound = null;
                string found = "";

                foreach (string s in ListShovel)
                {
                    idfound = HotkeysGame.FindHotkey(s);
                    if (idfound != 0)
                    {
                        found = s;
                        break;
                    }
                }

                if (idfound == -1)
                {
                    foreach (string s in ListShovel)
                    {
                        foreach (Objects.Container c in containers)
                        {
                            if (c.GetItems().Any(i => i.ItemName == s))
                            {
                                found = s;
                                cfound = c;
                                break;
                            }
                        }
                        if (cfound != null) break;
                    }
                }

                if (idfound == -1 && cfound == null) return;

                if (idfound != -1)
                {
                    InputControl.UseHot(idfound);
                    Thread.Sleep(Utils.RandomNumber(250, 500));
                    InputControl.Instance.LeftClickLoc(waypoint.Location);
                }
                else
                {
                    cfound.GetItems().First(i => i.ItemId == Items.FindByName(found).ItemID).UseOnMap(waypoint.Location);
                }

                Thread.Sleep(Utils.RandomNumber(500, 750));

                NextWaypoint(null, new CaveBotEventArgs(waypoint));
            }
            catch (ArgumentNullException ex)
            {
                Helpers.Debug.Report(ex);
            }
            catch (InvalidOperationException ex)
            {
                Helpers.Debug.Report(ex);
            }
        }
Exemplo n.º 3
0
 private void DoUse(Waypoint waypoint)
 {
     try
     {
         if (!Player.Location.IsAdjacentTo(waypoint.Location)) DoStand(waypoint);
         InputControl.Instance.RightClickLoc(waypoint.Location);
         NextWaypoint(null, new CaveBotEventArgs(waypoint));
     }
     catch (ArgumentNullException ex)
     {
         Helpers.Debug.Report(ex);
     }
     catch (InvalidOperationException ex)
     {
         Helpers.Debug.Report(ex);
     }  
 }
Exemplo n.º 4
0
 private void DoLadder(Waypoint waypoint)
 {
     NextWaypoint(null, new CaveBotEventArgs(waypoint));
 }
Exemplo n.º 5
0
 private void DoAction(Waypoint waypoint)
 {
     NextWaypoint(null, new CaveBotEventArgs(waypoint));
 }
Exemplo n.º 6
0
        private void DoNode(Waypoint waypoint)
        {
            Walker.Instance.Walksender = WalkSender.Walking;
            Walker.Instance.SkipNode = true;
            Walker.Instance.SkipNodeAmount = SkipNodes;
            Walker.Instance.WalkingMethod = CaveBot.Instance.WalkingMethod;

            Walker.Instance.SpecialAreas.Clear();

            foreach (SpecialArea area in SpecialAreasList)
                Walker.Instance.SpecialAreas.Add(area);

            Walker.Instance.Start = Player.Location;
            Walker.Instance.End = waypoint.Location;

            Walker.Instance.Walk();

            if (Player.Location.DistanceTo(waypoint.Location) <= CaveBot.Instance.SkipNodes)
                NextWaypoint(null, new CaveBotEventArgs(waypoint));
        }
Exemplo n.º 7
0
        private void DoStand(Waypoint waypoint)
        {
            Walker.Instance.WalkByFields = WalkByFields;
            Walker.Instance.WalkByPlayers = WalkByPlayers;
            Walker.Instance.Walksender = WalkSender.Walking;
            Walker.Instance.WalkingMethod = CaveBot.Instance.WalkingMethod;
            Walker.Instance.SkipNode = false;

            Walker.Instance.SpecialAreas.Clear();

            foreach (SpecialArea area in SpecialAreasList)
                Walker.Instance.SpecialAreas.Add(area);

            Walker.Instance.Start = Player.Location;
            Walker.Instance.End = waypoint.Location;

            Walker.Instance.Walk();

            Thread.Sleep(new Random().Next(250,500));

            if (Player.Location.Equals(waypoint.Location))
                NextWaypoint(null, new CaveBotEventArgs(waypoint));
            else
                if (Player.Location.Z != waypoint.Location.Z)
                    NextWaypoint(null, new CaveBotEventArgs(waypoint));
        }
Exemplo n.º 8
0
        private void ProcessWaypoint(Waypoint waypoint)
        {
            #region Increasing an amount of attempts to process waypoint

            waypoint.AttemptToRun++;

            if (!(waypoint.AttemptToRun < CaveBot.Instance.MaxAttempts))
                OnNextWaypoint(new CaveBotEventArgs(waypoint));

            #endregion

            try
            {
                switch (waypoint.WaypointType)
                {
                    case WaypointType.Action:
                        DoAction(waypoint);
                        break;
                    case WaypointType.Ladder:
                        DoLadder(waypoint);
                        break;
                    case WaypointType.Node:
                        DoNode(waypoint);
                        break;
                    case WaypointType.Rope:
                        DoRope(waypoint);
                        break;
                    case WaypointType.Shovel:
                        DoShovel(waypoint);
                        break;
                    case WaypointType.Stand:
                        DoStand(waypoint);
                        break;
                    case WaypointType.Use:
                        DoUse(waypoint);
                        break;
                    case WaypointType.Walk:
                        DoWalk(waypoint);
                        break;
                }
            }
            catch (ArgumentNullException ex)
            {
                Helpers.Debug.Report(ex);
            }
            catch (InvalidOperationException ex)
            {
                Helpers.Debug.Report(ex);
            }  

            WaypointProcessed(null, new CaveBotEventArgs(waypoint));
        }
Exemplo n.º 9
0
        private void CaveBotAddWpt_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Location location = Player.Location;

                switch ((Directions)CavebotWptDirection.SelectedItem)
                {
                    case Directions.North:
                        location.Y--;
                        break;
                    case Directions.West:
                        location.X--;
                        break;
                    case Directions.East:
                        location.X++;
                        break;
                    case Directions.South:
                        location.Y++;
                        break;
                    case Directions.NorthEast:
                        location.Y--;
                        location.X++;
                        break;
                    case Directions.NorthWest:
                        location.Y--;
                        location.X--;
                        break;
                    case Directions.SouthEast:
                        location.Y++;
                        location.X++;
                        break;
                    case Directions.SouthWest:
                        location.Y++;
                        location.X--;
                        break;
                }

                Waypoint waypoint = new Waypoint((WaypointType)CavebotWptType.SelectedItem, location, "");

                if (CavebotWptList.SelectedIndex != -1)
                    CaveBot.Instance.WaypointList.Insert(CavebotWptList.SelectedIndex + 1, waypoint);
                else
                    CaveBot.Instance.WaypointList.Add(waypoint);
            }
            catch (Exception ex)
            {
                Helpers.Debug.Report(ex);
            }
        }
Exemplo n.º 10
0
 public CaveBotEventArgs(Waypoint waypoint)
 {
     this.Waypoint = waypoint;
 }