Пример #1
0
 public void LoadWaypoints(String Location)
 {
     String[] WPTxt = File.ReadAllLines(Application.StartupPath+"\\Data\\Waypoints.fh");
     WayPoints.Clear();
     comboBox1.Items.Clear();
     List<MainForm.WayPoints> Result = new List<MainForm.WayPoints>();
     MainForm.WayPoints Temp = new MainForm.WayPoints();
     String Loc = "";
     for (int i = 0; i < WPTxt.Length; i++)
     {
         int Count = 0;
         int S1 = 0, S2 = 0, S3 = 0, S4 = 0, S5 = 0, S6 = 0, S7 = 0;
         for (int n = 0; n < WPTxt[i].Length; n++)
         {
             if (WPTxt[i].Substring(n, 1) == " ")
             {
                 switch (Count)
                 {
                     case 0:
                         S1 = n;
                         Count++;
                         break;
                     case 1:
                         S2 = n;
                         Count++;
                         break;
                     case 2:
                         S3 = n;
                         Count++;
                         break;
                     case 3:
                         S4 = n;
                         Count++;
                         break;
                     case 4:
                         S5 = n;
                         Count++;
                         break;
                 }
             }
             if (WPTxt[i].Substring(n, 1) == ".")
                 S6 = n;
             if (WPTxt[i].Substring(n, 1) == ";")
                 S7 = n;
         }
         Temp.X = (float)Convert.ToDouble(WPTxt[i].Substring(0, S1));
         Temp.Y = (float)Convert.ToDouble(WPTxt[i].Substring(S1, S2 - S1));
         Temp.Z = (float)Convert.ToDouble(WPTxt[i].Substring(S2, S3 - S2));
         Temp.NextWaypoint = (int)Convert.ToDouble(WPTxt[i].Substring(S3, S4 - S3));
         if (Loc!= WPTxt[i].Substring(S6 + 1, S7 - S6 - 1))
         {
             comboBox1.Items.Add(WPTxt[i].Substring(S6 + 1, S7 - S6 - 1));
             Loc = WPTxt[i].Substring(S6 + 1, S7 - S6 - 1);
         }
         if (Loc == Location)
         {
             WayPoints.Add(Temp);
         }
        }
 }
Пример #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (SelectedLoc == -1)
     {
         MessageBox.Show("Select location first!", "Farm helper info.", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     MainForm.WayPoints New = new MainForm.WayPoints();
     wow.Read();
     New.X            = wow.Objects[0].X;
     New.Y            = wow.Objects[0].Y;
     New.Z            = wow.Objects[0].Z;
     New.NextWaypoint = WayPoints.Count + 1;
     WayPoints.Add(New);
     FillListBox();
 }
Пример #3
0
        private int GetClosestWP(float X, float Y, float Z)
        {
            MainForm.WayPoints WP = new MainForm.WayPoints();
            WP.X = X; WP.Y = Y; WP.Z = Z;
            double MinRange     = 10000;
            int    ClosestIndex = 0;

            for (int i = 0; i < WowControl.WP.Length; i++)
            {
                double Range = WowControl.CheckPoint(WowControl.WP[i].X, WowControl.WP[i].Y, WowControl.WP[i].Z, WP.X, WP.Y, WP.Z);
                if (Range < MinRange)
                {
                    ClosestIndex = i;
                    MinRange     = WowControl.CheckPoint(WowControl.WP[i].X, WowControl.WP[i].Y, WowControl.WP[i].Z, WP.X, WP.Y, WP.Z);
                }
            }
            return(ClosestIndex);
        }
Пример #4
0
 private void WPTimer_Tick(object sender, EventArgs e)
 {
     if (checkBox1.Checked == true)
     {
         MainForm.WayPoints New  = new MainForm.WayPoints();
         MainForm.Coords    Temp = new MainForm.Coords();
         wow.Read();
         if (wow.Objects.Count == 0)
         {
             return;
         }
         Temp.X = wow.Objects[0].X;
         Temp.Y = wow.Objects[0].Y;
         Temp.Z = wow.Objects[0].Z;
         if (PCoord.ToArray().Length == 0)
         {
             New.X            = wow.Objects[0].X;
             New.Y            = wow.Objects[0].Y;
             New.Z            = wow.Objects[0].Z;
             New.NextWaypoint = WayPoints.Count + 1;
             WayPoints.Add(New);
             FillListBox();
             PCoord.Add(Temp);
         }
         else
         {
             if (WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, PCoord[PCoord.ToArray().Length - 1].X, PCoord[PCoord.ToArray().Length - 1].Y, PCoord[PCoord.ToArray().Length - 1].Z) > WPRange)
             {
                 New.X            = wow.Objects[0].X;
                 New.Y            = wow.Objects[0].Y;
                 New.Z            = wow.Objects[0].Z;
                 New.NextWaypoint = WayPoints.Count + 1;
                 WayPoints.Add(New);
                 if (checkBox2.Checked == true)
                 {
                     SetNextWP();
                 }
                 FillListBox();
                 PCoord.Add(Temp);
             }
         }
     }
 }
Пример #5
0
        private List <WaypointsInfo> GetClosestWPList(int WPNO, int Course, int WPRange, int FinishWaypoint)
        {
            List <WaypointsInfo> Result = new List <WaypointsInfo>();

            MainForm.WayPoints WP = new MainForm.WayPoints();
            WP.X = WowControl.WP[WPNO].X; WP.Y = WowControl.WP[WPNO].Y; WP.Z = WowControl.WP[WPNO].Z;
            for (int i = 0; i < WowControl.WP.Length; i++)
            {
                double Range = WowControl.CheckPoint(WowControl.WP[i].X, WowControl.WP[i].Y, WowControl.WP[i].Z, WP.X, WP.Y, WP.Z);
                if ((Range < WPRange) & (WaypointAlreadyInCourse(i, Course) == false))
                {
                    WaypointsInfo Temp = new WaypointsInfo();
                    Temp.Index = i;
                    Temp.Range = Range;
                    Result.Add(Temp);
                }
            }
            Result.Sort((a, b) => a.Range.CompareTo(b.Range));
            return(Result);
        }
Пример #6
0
        public static MainForm.WayPoints[] LoadWaypoints(String Location)
        {
            String[] WPTxt = File.ReadAllLines(Application.StartupPath + "\\Data\\Waypoints.fh");
            List <MainForm.WayPoints> Result = new List <MainForm.WayPoints>();

            MainForm.WayPoints Temp = new MainForm.WayPoints();
            for (int i = 0; i < WPTxt.Length; i++)
            {
                int Count = 0;
                int S1 = 0, S2 = 0, S3 = 0, S4 = 0, S5 = 0, S6 = 0, S7 = 0;
                for (int n = 0; n < WPTxt[i].Length; n++)
                {
                    if (WPTxt[i].Substring(n, 1) == " ")
                    {
                        switch (Count)
                        {
                        case 0:
                            S1 = n;
                            Count++;
                            break;

                        case 1:
                            S2 = n;
                            Count++;
                            break;

                        case 2:
                            S3 = n;
                            Count++;
                            break;

                        case 3:
                            S4 = n;
                            Count++;
                            break;

                        case 4:
                            S5 = n;
                            Count++;
                            break;
                        }
                    }
                    if (WPTxt[i].Substring(n, 1) == ".")
                    {
                        S6 = n;
                    }
                    if (WPTxt[i].Substring(n, 1) == ";")
                    {
                        S7 = n;
                    }
                }
                Temp.X            = (float)Convert.ToDouble(WPTxt[i].Substring(0, S1));
                Temp.Y            = (float)Convert.ToDouble(WPTxt[i].Substring(S1, S2 - S1));
                Temp.Z            = (float)Convert.ToDouble(WPTxt[i].Substring(S2, S3 - S2));
                Temp.NextWaypoint = (int)Convert.ToDouble(WPTxt[i].Substring(S3, S4 - S3));
                String Loc = WPTxt[i].Substring(S6 + 1, S7 - S6 - 1);
                if (Loc == Location)
                {
                    Result.Add(Temp);
                }
            }
            LoadedWP = Location;
            if (Result.ToArray().Length > 0)
            {
                UpdateStatus("Waypoints [" + Result.ToArray().Length.ToString() + "] loaded for " + LoadedWP + ".");
            }
            else
            {
                UpdateStatus("Waypoints missing for " + Location + ".");
            }
            return(Result.ToArray());
        }
Пример #7
0
 private List<WaypointsInfo> GetClosestWPList(int WPNO, int Course, int WPRange, int FinishWaypoint)
 {
     List<WaypointsInfo> Result = new List<WaypointsInfo>();
     MainForm.WayPoints WP = new MainForm.WayPoints();
     WP.X = WowControl.WP[WPNO].X; WP.Y = WowControl.WP[WPNO].Y; WP.Z = WowControl.WP[WPNO].Z;
     for (int i = 0; i < WowControl.WP.Length; i++)
     {
         double Range = WowControl.CheckPoint(WowControl.WP[i].X, WowControl.WP[i].Y, WowControl.WP[i].Z, WP.X, WP.Y, WP.Z);
         if ((Range < WPRange) & (WaypointAlreadyInCourse(i, Course) == false))
         {
             WaypointsInfo Temp = new WaypointsInfo();
             Temp.Index = i;
             Temp.Range = Range;
             Result.Add(Temp);
         }
     }
     Result.Sort((a, b) => a.Range.CompareTo(b.Range));
     return Result;
 }
Пример #8
0
 private int GetClosestWP(float X, float Y, float Z)
 {
     MainForm.WayPoints WP = new MainForm.WayPoints();
     WP.X = X; WP.Y = Y; WP.Z = Z;
     double MinRange = 10000;
     int ClosestIndex = 0;
     for (int i = 0; i < WowControl.WP.Length; i++)
     {
         double Range = WowControl.CheckPoint(WowControl.WP[i].X, WowControl.WP[i].Y, WowControl.WP[i].Z, WP.X, WP.Y, WP.Z);
         if (Range < MinRange)
         {
             ClosestIndex = i;
             MinRange = WowControl.CheckPoint(WowControl.WP[i].X, WowControl.WP[i].Y, WowControl.WP[i].Z, WP.X, WP.Y, WP.Z);
         }
     }
     return ClosestIndex;
 }
Пример #9
0
 private void WPTimer_Tick(object sender, EventArgs e)
 {
     if (checkBox1.Checked == true)
     {
         MainForm.WayPoints New = new MainForm.WayPoints();
         MainForm.Coords Temp = new MainForm.Coords();
         wow.Read();
         if (wow.Objects.Count == 0)
             return;
         Temp.X = wow.Objects[0].X;
         Temp.Y = wow.Objects[0].Y;
         Temp.Z = wow.Objects[0].Z;
         if (PCoord.ToArray().Length == 0)
         {
             New.X = wow.Objects[0].X;
             New.Y = wow.Objects[0].Y;
             New.Z = wow.Objects[0].Z;
             New.NextWaypoint = WayPoints.Count + 1;
             WayPoints.Add(New);
             FillListBox();
             PCoord.Add(Temp);
         }
         else
         {
             if (WowControl.CheckPoint(wow.Objects[0].X, wow.Objects[0].Y, wow.Objects[0].Z, PCoord[PCoord.ToArray().Length - 1].X, PCoord[PCoord.ToArray().Length - 1].Y, PCoord[PCoord.ToArray().Length - 1].Z) > WPRange)
             {
                 New.X = wow.Objects[0].X;
                 New.Y = wow.Objects[0].Y;
                 New.Z = wow.Objects[0].Z;
                 New.NextWaypoint = WayPoints.Count + 1;
                 WayPoints.Add(New);
                 if (checkBox2.Checked == true)
                     SetNextWP();
                 FillListBox();
                 PCoord.Add(Temp);
             }
         }
     }
 }
Пример #10
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (SelectedLoc == -1)
     {
         MessageBox.Show("Select location first!", "Farm helper info.", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     MainForm.WayPoints New = new MainForm.WayPoints();
     wow.Read();
     New.X = wow.Objects[0].X;
     New.Y = wow.Objects[0].Y;
     New.Z = wow.Objects[0].Z;
     New.NextWaypoint = WayPoints.Count + 1;
     WayPoints.Add(New);
     FillListBox();
 }
Пример #11
0
 public static MainForm.WayPoints[] LoadWaypoints(String Location)
 {
     String[] WPTxt = File.ReadAllLines(Application.StartupPath + "\\Data\\Waypoints.fh");
     List<MainForm.WayPoints> Result = new List<MainForm.WayPoints>();
     MainForm.WayPoints Temp = new MainForm.WayPoints();
     for (int i = 0; i < WPTxt.Length; i++)
     {
         int Count = 0;
         int S1 = 0, S2 = 0, S3 = 0, S4 = 0, S5 = 0, S6 = 0, S7 = 0;
         for (int n = 0; n < WPTxt[i].Length; n++)
         {
             if (WPTxt[i].Substring(n, 1) == " ")
             {
                 switch (Count)
                 {
                     case 0:
                         S1 = n;
                         Count++;
                         break;
                     case 1:
                         S2 = n;
                         Count++;
                         break;
                     case 2:
                         S3 = n;
                         Count++;
                         break;
                     case 3:
                         S4 = n;
                         Count++;
                         break;
                     case 4:
                         S5 = n;
                         Count++;
                         break;
                 }
             }
             if (WPTxt[i].Substring(n, 1) == ".")
                 S6 = n;
             if (WPTxt[i].Substring(n, 1) == ";")
                 S7 = n;
         }
         Temp.X = (float)Convert.ToDouble(WPTxt[i].Substring(0, S1));
         Temp.Y = (float)Convert.ToDouble(WPTxt[i].Substring(S1, S2 - S1));
         Temp.Z = (float)Convert.ToDouble(WPTxt[i].Substring(S2, S3 - S2));
         Temp.NextWaypoint = (int)Convert.ToDouble(WPTxt[i].Substring(S3, S4 - S3));
         String Loc = WPTxt[i].Substring(S6 + 1, S7 - S6 - 1);
         if (Loc == Location)
             Result.Add(Temp);
     }
     LoadedWP = Location;
     if (Result.ToArray().Length > 0)
         UpdateStatus("Waypoints [" + Result.ToArray().Length.ToString() + "] loaded for " + LoadedWP + ".");
     else
         UpdateStatus("Waypoints missing for " + Location + ".");
     return Result.ToArray();
 }
Пример #12
0
        public void LoadWaypoints(String Location)
        {
            String[] WPTxt = File.ReadAllLines(Application.StartupPath + "\\Data\\Waypoints.fh");
            WayPoints.Clear();
            comboBox1.Items.Clear();
            List <MainForm.WayPoints> Result = new List <MainForm.WayPoints>();

            MainForm.WayPoints Temp = new MainForm.WayPoints();
            String             Loc  = "";

            for (int i = 0; i < WPTxt.Length; i++)
            {
                int Count = 0;
                int S1 = 0, S2 = 0, S3 = 0, S4 = 0, S5 = 0, S6 = 0, S7 = 0;
                for (int n = 0; n < WPTxt[i].Length; n++)
                {
                    if (WPTxt[i].Substring(n, 1) == " ")
                    {
                        switch (Count)
                        {
                        case 0:
                            S1 = n;
                            Count++;
                            break;

                        case 1:
                            S2 = n;
                            Count++;
                            break;

                        case 2:
                            S3 = n;
                            Count++;
                            break;

                        case 3:
                            S4 = n;
                            Count++;
                            break;

                        case 4:
                            S5 = n;
                            Count++;
                            break;
                        }
                    }
                    if (WPTxt[i].Substring(n, 1) == ".")
                    {
                        S6 = n;
                    }
                    if (WPTxt[i].Substring(n, 1) == ";")
                    {
                        S7 = n;
                    }
                }
                Temp.X            = (float)Convert.ToDouble(WPTxt[i].Substring(0, S1));
                Temp.Y            = (float)Convert.ToDouble(WPTxt[i].Substring(S1, S2 - S1));
                Temp.Z            = (float)Convert.ToDouble(WPTxt[i].Substring(S2, S3 - S2));
                Temp.NextWaypoint = (int)Convert.ToDouble(WPTxt[i].Substring(S3, S4 - S3));
                if (Loc != WPTxt[i].Substring(S6 + 1, S7 - S6 - 1))
                {
                    comboBox1.Items.Add(WPTxt[i].Substring(S6 + 1, S7 - S6 - 1));
                    Loc = WPTxt[i].Substring(S6 + 1, S7 - S6 - 1);
                }
                if (Loc == Location)
                {
                    WayPoints.Add(Temp);
                }
            }
        }