Exemplo n.º 1
0
        public static bool Convert(string path)
        {
            try
            {
                if (IsMMoLazyFlyerProfile(path))
                {
                    GatherProfile   _origineProfile = XmlSerializer.Deserialize <GatherProfile>(path);
                    GathererProfile _profile        = new GathererProfile();

                    foreach (Position p in _origineProfile.Waypoints_Normal)
                    {
                        _profile.Points.Add(new Point(p.X, p.Y, p.Z, "Flying"));
                    }


                    string fileName = Path.GetFileNameWithoutExtension(path);

                    if (XmlSerializer.Serialize(Application.StartupPath + "\\Profiles\\Gatherer\\" + fileName + ".xml",
                                                _profile))
                    {
                        Logging.Write("Conversion Success (MMOLazy MyFlyer to Gatherer bot): " + fileName);
                        return(true);
                    }
                }
            }
            catch
            {
            }
            Logging.Write("Conversion Failled (MMOLazy MyFlyer to Gatherer bot): " + path);
            return(false);
        }
Exemplo n.º 2
0
        public static bool Convert(string path)
        {
            try
            {
                GathererProfile flyingProfile     = XmlSerializer.Deserialize <GathererProfile>(path);
                string          flyingProfileName = Path.GetFileNameWithoutExtension(path);

                if (flyingProfile.Points.Count <= 0)
                {
                    Logging.Write(string.Format("The file {0} is not a valid Gatherer Profile.", flyingProfileName));
                    return(false);
                }

                if (flyingProfile.Points.Any(p => p.Type.ToLower() == "flying"))
                {
                    MovementManager.FlyingToGroundProfilesConverter(flyingProfile.Points, out _points, out _result);
                }
                else
                {
                    Logging.Write(string.Format("The profile {0} is not a Flying Gatherer Profile.", flyingProfileName));
                    return(false);
                }
                if (!_result)
                {
                    return(false);
                }
                flyingProfile.Points = _points;
                string pathDir  = Application.StartupPath + "\\Profiles\\Gatherer\\";
                string fullPath = pathDir + "Ground_" + flyingProfileName + ".xml";
                if (XmlSerializer.Serialize(fullPath, flyingProfile))
                {
                    Logging.Write(string.Format("The Flying profile {0} have been saved.", flyingProfileName));
                    Logging.Write("Path: " + fullPath);
                    return(true);
                }
                Logging.Write(string.Format("The Flying profile {0} have not been saved correctly, make sure you have access right on the directory {1}.",
                                            flyingProfileName, pathDir));
                return(false);
            }
            catch
            {
                Logging.Write("Conversion Failled (WowRobot to Gatherer bot): " + path);
                return(false);
            }
        }
Exemplo n.º 3
0
        public static bool Convert(string path)
        {
            try
            {
                if (IsPiroxFlyGathererProfile(path))
                {
                    GathererProfile _profile = new GathererProfile();
                    IniFile         file     = new IniFile(path);
                    for (int i = 1; i < 0x2710; i++)
                    {
                        string str4 = file.IniReadValue("GoTo", "z" + i);
                        if ((str4 != null) && str4.StartsWith("WPX"))
                        {
                            string[] strArray =
                                str4.Replace("WPX", "")
                                .Replace("(", "")
                                .Replace(")", "")
                                .Trim()
                                .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                            Point item = new Point(float.Parse(strArray[0], CultureInfo.InvariantCulture),
                                                   float.Parse(strArray[1], CultureInfo.InvariantCulture),
                                                   float.Parse(strArray[2], CultureInfo.InvariantCulture), "Flying");
                            _profile.Points.Add(item);
                        }
                    }


                    string fileName = Path.GetFileNameWithoutExtension(path);

                    if (XmlSerializer.Serialize(Application.StartupPath + "\\Profiles\\Gatherer\\" + fileName + ".xml",
                                                _profile))
                    {
                        Logging.Write("Conversion Success (Pirox Fly Gatherer to Gatherer bot): " + fileName);
                        return(true);
                    }
                }
            }
            catch
            {
            }
            Logging.Write("Conversion Failled (Pirox Fly Gatherer to Gatherer bot): " + path);
            return(false);
        }
Exemplo n.º 4
0
        public static bool Convert(string path)
        {
            try
            {
                if (IsWowRobotGatherFlyProfile(path))
                {
                    Profile         origineProfile = XmlSerializer.Deserialize <Profile>(path);
                    GathererProfile profile        = new GathererProfile();

                    foreach (Point p in origineProfile.Points)
                    {
                        profile.Points.Add(new Point(p.X, p.Y, p.Z, "Flying"));
                    }
                    foreach (Point p in origineProfile.BlackListPoints)
                    {
                        profile.BlackListRadius.Add(new GathererBlackListRadius {
                            Position = p, Radius = 15
                        });
                    }


                    string fileName = Path.GetFileNameWithoutExtension(path);

                    if (XmlSerializer.Serialize(Application.StartupPath + "\\Profiles\\Gatherer\\" + fileName + ".xml",
                                                profile))
                    {
                        Logging.Write("Conversion Success (WowRobot to Gatherer bot): " + fileName);
                        return(true);
                    }
                }
            }
            catch
            {
            }
            Logging.Write("Conversion Failled (WowRobot to Gatherer bot): " + path);
            return(false);
        }
Exemplo n.º 5
0
        public static bool Convert(string path)
        {
            try
            {
                if (IsGatherBuddyProfile(path))
                {
                    GathererProfile _profile = new GathererProfile();

                    #region LoadProfileBuddy

                    XElement xml = XElement.Load(path);

                    // Loop through Elements Collection
                    foreach (XElement child in xml.Elements())
                    {
                        // Si glider profile
                        if (child.Name.ToString().ToLower() == "Waypoint".ToLower())
                        {
                            string tempsPosition = child.Value;

                            if (tempsPosition.Replace(" ", "").Length > 0)
                            {
                                string[] positionTempsString =
                                    tempsPosition.Replace("  ", " ").Split(' ');
                                if (positionTempsString.Length == 3)
                                {
                                    try
                                    {
                                        _profile.Points.Add(new Point(
                                                                Others.ToSingle(
                                                                    positionTempsString[0]),
                                                                Others.ToSingle(
                                                                    positionTempsString[1]),
                                                                Others.ToSingle(
                                                                    positionTempsString[2]),
                                                                "Flying"));
                                    }
                                    catch
                                    {
                                    }
                                }
                            }
                        }

                        // Vendeur gather buddy

                        /*
                         * if (child.Name.ToString().ToLower() == "Vendors".ToLower())
                         * {
                         *  foreach (XElement childVendors in child.Elements())
                         *  {
                         *      try
                         *      {
                         *          if (childVendors.Name.ToString().ToLower() == "Vendor".ToLower())
                         *          {
                         *              XAttribute x = childVendors.Attribute("X");
                         *              if (x == null)
                         *                  x = childVendors.Attribute("x");
                         *              XAttribute y = childVendors.Attribute("Y");
                         *              if (y == null)
                         *                  y = childVendors.Attribute("y");
                         *              XAttribute z = childVendors.Attribute("Z");
                         *              if (z == null)
                         *                  z = childVendors.Attribute("z");
                         *              if (x != null)
                         *              {
                         *                  if (y != null)
                         *                  {
                         *                      if (z != null)
                         *                      {
                         *                          var npc =
                         *                              new Npc
                         *                                  {
                         *                                      Position =
                         *                                          new Point(
                         *                                          Others.ToSingle(x.Value),
                         *                                          Others.ToSingle(y.Value),
                         *                                          Others.ToSingle(z.Value),
                         *                                          "Flying"),
                         *                                      Entry =
                         *                                          System.Convert.ToInt32(childVendors.Attribute("Entry")),
                         *                                      Faction = Npc.FactionType.Neutral,
                         *                                      Name = childVendors.Attribute("Name").ToString(),
                         *                                      Type =
                         *                                          (Npc.NpcType)
                         *                                          Enum.Parse(typeof (Npc.NpcType),
                         *                                                     childVendors.Attribute("Type").ToString(),
                         *                                                     true),
                         *                                                     ContinentId = ContinentId.None
                         *                                  }
                         *
                         *                              ;
                         *                          _profile.Npc.Add(npc);
                         *                      }
                         *                  }
                         *              }
                         *          }
                         *      }
                         *      catch {}
                         *  }
                         * }
                         *
                         */
                        // Position gather buddy
                        if (child.Name.ToString().ToLower() == "Hotspots".ToLower())
                        {
                            foreach (XElement childHotspots in child.Elements())
                            {
                                if (childHotspots.Name.ToString().ToLower() == "Hotspot".ToLower())
                                {
                                    XAttribute x = childHotspots.Attribute("X") ?? childHotspots.Attribute("x");
                                    XAttribute y = childHotspots.Attribute("Y") ?? childHotspots.Attribute("y");
                                    XAttribute z = childHotspots.Attribute("Z") ?? childHotspots.Attribute("z");
                                    float      xF;
                                    if (float.TryParse(x.Value, NumberStyles.Number, CultureInfo.InvariantCulture,
                                                       out xF))
                                    {
                                        float yF;
                                        if (float.TryParse(y.Value, NumberStyles.Number, CultureInfo.InvariantCulture,
                                                           out yF))
                                        {
                                            float zF;
                                            if (float.TryParse(z.Value, NumberStyles.Number, CultureInfo.InvariantCulture, out zF))
                                            {
                                                Point pT = new Point(xF, yF, zF, "Flying");
                                                _profile.Points.Add(pT);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }

                    #endregion LoadProfileBuddy

                    string fileName = Path.GetFileNameWithoutExtension(path);
                    if (XmlSerializer.Serialize(Application.StartupPath + "\\Profiles\\Gatherer\\" + fileName + ".xml",
                                                _profile))
                    {
                        Logging.Write("Conversion Success (GatherBuddy to Gatherer bot): " + fileName);
                        return(true);
                    }
                }
            }
            catch
            {
            }
            Logging.Write("Conversion Failled (GatherBuddy to Gatherer bot): " + path);
            return(false);
        }