Exemple #1
0
        private void btnAddWaypoint_Click(object sender, System.EventArgs e)
        {
            if (cbxPatrolAreas.SelectedIndex == -1)
            {
                MessageBox.Show("Please select the Travel Path first.", "Add Waypoint Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            PatrolArea patrolarea;

            try
            {
                patrolarea = _patrolareas.GetPatrolArea(cbxPatrolAreas.SelectedItem.ToString());
            }
            catch (Exception E)
            {
                MessageBox.Show(E.Message, "Load Area Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            if (_ak.GameProcess == 0)
            {
                return;
            }

            //generate default waypoint name
            string itemName = "no name";

            if (sender == null)            //auto add
            {
                itemName = "auto add";
            }

            // add the current players location to the patrol area waypoint list
            patrolarea.AddWaypoint(_ak.gPlayerXCoord, _ak.gPlayerYCoord, _ak.gPlayerZCoord, itemName);

            //create a new waypoint object for storing in the ListViewItem
            Waypoint wpt = new Waypoint(_ak, patrolarea.GetNewestWaypoint());

            //create a ListViewItem, set its display strings, and attach the waypoint object
            ListViewItem lvi = new ListViewItem(itemName, 0);

            lvi.SubItems.Add(_ak.gPlayerXCoord.ToString());
            lvi.SubItems.Add(_ak.gPlayerYCoord.ToString());
            lvi.Tag = wpt;

            //add the ListViewItem to our listview
            lvwPatrolArea.Items.Add(lvi);

            //if not auto add, put new item in edit mode so user sees they can name it
            if (sender != null)
            {
                lvi.BeginEdit();
            }
        }
Exemple #2
0
        private void btnStart_Click(object sender, System.EventArgs e)
        {
            if (cbxPatrolAreas.SelectedIndex == -1)
            {
                return;
            }

            PatrolArea patrolarea;

            try
            {
                patrolarea = _patrolareas.GetPatrolArea(cbxPatrolAreas.SelectedItem.ToString());
            }
            catch (Exception E)
            {
                MessageBox.Show(E.Message, "Load Area Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            // make sure this travel list has waypoints defined
            if (patrolarea.NumWaypoints < 1)
            {
                MessageBox.Show("There are no waypoints defined for this Travel Path / Patrol Area", "No Waypoints Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            // make sure the user selected a destination
            if (cbxDestinations.SelectedIndex == -1)
            {
                MessageBox.Show("You must select a Destination!", "No Destination Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            //lets see if the user is far away from the selected path/area and warn them
            Waypoint wpt  = patrolarea.FindClosest(FindDirection());            //also sets next point in waypoint internal list iterations
            double   dist = _ak.ZDistance(_ak.gPlayerXCoord, _ak.gPlayerYCoord, _ak.gPlayerZCoord, wpt.X, wpt.Y, wpt.Z);

            if (dist > 5000)
            {
                if (MessageBox.Show("You are far away from this Waypoint Path / Patrol Area, are you sure you want to run to this location?", "Distance Warning",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
            }

            Interaction.AppActivate(_ak.GameProcess);
            Thread.Sleep(750);

            //tell movement thread to run
            _bKeepRunning = true;
        }
Exemple #3
0
        public frmTravelPath(PatrolAreas patrolareas, AutoKillerScript.clsAutoKillerScript ak)
        {
            _patrolareas = patrolareas;
            _ak          = ak;

            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            this.lvwPatrolArea.Validated += new EventHandler(lvwPatrolArea_Validated);

            //we have our PatrolAreas class, lets load the comboBox with the area names
            foreach (string patrolareaname in _patrolareas.GetAllPatrolAreas())
            {
                if (_patrolareas.GetPatrolArea(patrolareaname).Type == PatrolType.TravelPath)
                {
                    cbxPatrolAreas.Items.Add(patrolareaname);
                }
            }

            // set up our timer for recording waypoints as the player runs
            AutoWaypointsTimer          = new System.Windows.Forms.Timer();
            AutoWaypointsTimer.Interval = 1000;
            AutoWaypointsTimer.Tick    += new EventHandler(AutoWaypointsTimer_Expired);
            AutoWaypointsTimer.Enabled  = true;
            AutoWaypointsTimer.Stop();
        }
Exemple #4
0
        private void btnGetTarget_Click(object sender, System.EventArgs e)
        {
            if (cbxPatrolAreas.SelectedIndex == -1)
            {
                MessageBox.Show("Please select the Patrol Area first.", "Add Target Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            if (_ak.TargetObject == null)
            {
                MessageBox.Show("Target something in the game first.", "Add Target Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            string targetName = _ak.TargetObject.Name;

            PatrolArea patrolarea = _patrolareas.GetPatrolArea(cbxPatrolAreas.SelectedItem.ToString());

            lbxTargets.Items.Add(targetName);
            patrolarea.AddTarget(targetName);
        }