Esempio n. 1
0
        public void LoadWaypoints()
        {
            OpenFileDialog dlg    = new OpenFileDialog();
            var            _with1 = dlg;

            _with1.Title  = "Load Waypoints Config";
            _with1.Filter = "WaypointList (*.lwt)|*.lwt";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                FileStream   fs           = new FileStream(dlg.FileName, FileMode.Open);
                BinaryReader BinaryReader = new BinaryReader(fs);
                int          Lenght       = BinaryReader.ReadInt32();
                for (int i = 0; i <= Lenght - 1; i++)
                {
                    Objects.Bot.Waypoint   w    = new Objects.Bot.Waypoint();
                    Constants.WaypointType type = (Constants.WaypointType)BinaryReader.ReadByte();
                    int    x       = BinaryReader.ReadInt32();
                    int    y       = BinaryReader.ReadInt32();
                    byte   z       = BinaryReader.ReadByte();
                    string script  = BinaryReader.ReadString();
                    string comment = BinaryReader.ReadString();

                    w.Location = new Location(x, y, z);
                    w.Type     = type;
                    w.Script   = script;
                    if (w.Script.ToLower() == "nextwaypoint")
                    {
                        w.Script = "NextWaypoint()";
                    }
                    w.Comment = comment;
                    Core.Global.Waypoints.Add(w);
                }
                fs.Close();
            }
        }
Esempio n. 2
0
 public Waypoint(Location loc, Constants.WaypointType type)
 {
     Location = loc;
     Type     = type;
     Script   = "NextWaypoint()";
     Comment  = "";
 }