Beispiel #1
0
        private void record()
        {
            profile = new Profile();
            profile.setName(this.name.Text);
            Player p = new Player(0, false);

            recording = true;
            while (recording)
            {
                if (this.normalCheckBox.Checked)
                {
                    Thread.Sleep(100);
                    Mob m = (Mob)p.checkForTarget(this);
                    if (m != null)
                    {
                        UInt16 fac = m.getFaction();
                        if (profile.getFactions().Contains(fac) == false)
                        {
                            profile.addFaction(fac);
                        }
                    }

                    Waypoint pLoc = p.getLocation();
                    if (profile.getWaypoints().Count == 0)
                    {
                        profile.AddWaypoint(pLoc);
                    }
                    else if (profile.getWaypoints().Last <Waypoint>().getDistance(pLoc) > 10.0f)
                    {
                        profile.AddWaypoint(pLoc);
                    }
                }
                else if (this.ghostCheckBox.Checked)
                {
                    Waypoint pLoc = p.getLocation();
                    if (profile.getGhostWaypoints().Count == 0)
                    {
                        profile.AddGhostWaypoint(pLoc);
                    }
                    else if (profile.getGhostWaypoints().Last <Waypoint>().getDistance(pLoc) > 10.0f)
                    {
                        profile.AddGhostWaypoint(pLoc);
                    }
                }
                else
                {
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Attempts to load a Glider Profile.
        /// </summary>
        /// <param name="path">Absolute Path to Glider Profile.</param>
        /// <returns>A Stab Face Profile.</returns>
        public static Profile LoadGliderProfile(String path)
        {
            Profile p = new Profile();

            using (FileStream reader = new FileStream(path,
                                                      FileMode.Open, FileAccess.Read))
            {
                XmlReader xreader        = XmlReader.Create(reader);
                String    currentElement = "";
                while (xreader.Read())
                {
                    switch (xreader.NodeType)
                    {
                    case XmlNodeType.Element:
                        currentElement = xreader.Name;
                        break;

                    case XmlNodeType.Text:
                        switch (currentElement.ToUpper())
                        {
                        case "MINLEVEL":
                            //TODO
                            Debug.WriteLine("MinLevel: " + xreader.Value);
                            break;

                        case "MAXLEVEL":
                            //TODO
                            Debug.WriteLine("MaxLevel: " + xreader.Value);
                            break;

                        case "FACTIONS":
                            String[] facs = xreader.Value.Split(' ');
                            foreach (string fac in facs)
                            {
                                p.addFaction(Convert.ToUInt16(fac));
                            }
                            break;

                        case "LUREMINUTES":
                            //TODO
                            Debug.WriteLine("LureMinutes: " + xreader.Value);
                            break;

                        case "SKIPWAYPOINTS":
                            //TODO
                            Debug.WriteLine("SkipWaypoints: " + xreader.Value);
                            break;

                        case "NATURALRUN":
                            //TODO
                            Debug.WriteLine("NaturalRun: " + xreader.Value);
                            break;

                        case "WAYPOINT":
                            String[] wps = xreader.Value.Split(' ');
                            p.AddWaypoint(new Waypoint(
                                              Convert.ToSingle(wps[0]),
                                              Convert.ToSingle(wps[1]),
                                              0.0f));
                            break;

                        case "GHOSTWAYPOINT":
                            String[] gwps = xreader.Value.Split(' ');
                            p.AddGhostWaypoint(new Waypoint(
                                                   Convert.ToSingle(gwps[0]),
                                                   Convert.ToSingle(gwps[1]),
                                                   0.0f));
                            break;

                        default:
                            break;
                        }
                        break;
                    }
                }
            }

            return(p);
        }