示例#1
0
        private static bool IsValidTarget(PUnit unitTofind)
        {
            if (unitTofind.IsPlayer || unitTofind.IsTagged || unitTofind.IsDead || unitTofind.IsTotem)
            {
                return(false);
            }
            SubProfile currentProfile = GrindingEngine.CurrentProfile.GetSubProfile();

            if (unitTofind.Level < currentProfile.MobMinLevel ||
                unitTofind.Level > currentProfile.MobMaxLevel)
            {
                return(false);
            }
            if (currentProfile.Ignore != null)
            {
                if (currentProfile.Ignore.Any(tstIgnore => tstIgnore == unitTofind.Name))
                {
                    return(false);
                }
            }
            if (currentProfile.Factions != null)
            {
                if (currentProfile.Factions.Any(faction => unitTofind.Faction == faction))
                {
                    return(true);
                }
            }
            return(false);
        }
        public ClrIntensityDataProfile(FileType[] availableTypes)
            : base("Color Intensity", "Based on color intensity of the image.",
                   availableTypes, new string[] { "jpg", "bmp", "png" })
        {
            // TODO: ^Could do with file type categories / profiles??

            subProfiles = new SubProfile[] { new SubProfile("Grey-Scale", Resource1.ClrIntensityProfile_GreyScaleDesc, new GreyScaleFilter()),
                                             new SubProfile("Full-Spectrum", Resource1.ClrIntensityProfile_FullSpectrum, new FullSpecrumFilter()) };
        }
        public ClrIntensityDataProfile(FileType[] availableTypes)
            : base("Color Intensity", "Based on color intensity of the image.",
                   availableTypes, new string[] { "jpg", "bmp", "png" })
        {
            // TODO: ^Could do with file type categories / profiles??

            subProfiles = new SubProfile[] { new SubProfile("Grey-Scale", Resource1.ClrIntensityProfile_GreyScaleDesc, new GreyScaleFilter()),
                                             new SubProfile("Full-Spectrum", Resource1.ClrIntensityProfile_FullSpectrum, new FullSpecrumFilter()) };
        }
示例#4
0
        private static void FindMobToPull()
        {
            while (true)
            {
                var          tmpValidTargets   = new List <PUnit>();
                List <PUnit> units             = ObjectManager.GetUnits;
                SubProfile   currentSubprofile = GrindingEngine.CurrentProfile.GetSubProfile();
                foreach (PUnit pUnit in units.Where(u => u.IsValid))
                {
                    try
                    {
                        if (IsValidTarget(pUnit) &&
                            !PPullBlackList.IsBlacklisted(pUnit) &&
                            !PBlackList.IsBlacklisted(pUnit) &&
                            pUnit.Target.Type != 4)
                        {
                            if (GrindingSettings.SkipMobsWithAdds)
                            {
                                List <PUnit> closeUnits = ObjectManager.CheckForMobsAtLoc(pUnit.Location,
                                                                                          GrindingSettings.
                                                                                          SkipAddsDistance, false);
                                if (closeUnits.Count >= GrindingSettings.SkipAddsCount)
                                {
                                    continue;
                                }
                            }
                            PUnit unit = pUnit;
                            if (
                                currentSubprofile.Spots.Any(
                                    s => unit.Location.DistanceFrom(s) < currentSubprofile.SpotRoamDistance))
                            {
                                if (!pUnit.IsPet) //Do not move, takes a long time
                                {
                                    tmpValidTargets.Add(pUnit);
                                }
                            }
                        }
                    }
                    catch
                    {
                    }
                }

                IOrderedEnumerable <PUnit> sortednumQuery =
                    from t in tmpValidTargets
                    orderby t.Location.DistanceToSelf
                    select t;

                ValidUnits = sortednumQuery.ToList();
                Thread.Sleep(500);
            }
        }
 public GISValueDataProfile(FileType[] availableTypes)
     : base("GIS Height Value", "Based on the height values", availableTypes,
            new string[] { "dem" })
 {
     subProfiles = new SubProfile[] { new SubProfile("Raw height values", "Uses purely the height values for direct conversion", new RawHeightFilter()) };
 }
示例#6
0
        private bool SetupProfile()
        {
            try
            {
                if (Profile == null)
                {
                    return(false);
                }

                //SubProfile = ProfileHelper.GetAppropriateSubProfile(Profile);
                var myLevel = Manager.LocalPlayer.Level;
                foreach (var s in Profile.SubProfile)
                {
                    if (s.MinLevel <= myLevel && s.MaxLevel >= myLevel)
                    {
                        SubProfile = s;
                    }
                }

                // Profile doesnt contain anything for our level?
                if (SubProfile == null)
                {
                    return(false);
                }

                if (Hotspots == null)
                {
                    Hotspots = new List <Location>();
                }
                Hotspots.Clear();

                for (int i = 0; i < SubProfile.GrindArea[0].Hotspots.Count(); i++)
                {
                    var hotspot = SubProfile.GrindArea[0].Hotspots[i];
                    Hotspots.Add(hotspot.Location);
                }

                //Print("Loaded subprofile {0} (Level range: {1}-{2}) with {3} hotspots", SubProfile.Name, SubProfile.MinLevel,
                //      SubProfile.MaxLevel, Hotspots.Count);

                var states = new List <State>
                {
                    new GBReleaseCorpse(this),
                    new GBCorpseRun(this),
                    new GBRetrieveCorpse(this),
                    new GBCombat(this),
                    new GBGoto(this),
                    new GBLoot(this),
                    new GBPull(this),
                    new GBPatrol(this)
                };

                FSM.LoadStates(states);

                //Print("Loaded {0} states", states.Count);
            }
            catch (Exception)
            {
                Print("This profile is a mess, fix it or get a new one!");
                return(false);
            }
            return(true);
        }
 public GISValueDataProfile(FileType[] availableTypes)
     : base("GIS Height Value", "Based on the height values", availableTypes,
            new string[] { "dem" })
 {
     subProfiles = new SubProfile[] { new SubProfile("Raw height values", "Uses purely the height values for direct conversion", new RawHeightFilter()) };
 }
示例#8
0
 private void ButtonX3Click(object sender, EventArgs h)
 {
     if (string.IsNullOrEmpty(_folderSelected))
     {
         MessageBox.Show("Please select a folder.");
         return;
     }
     if (string.IsNullOrEmpty(_xmlFile))
     {
         MessageBox.Show("Please select a profile to convert.");
         return;
     }
     _waypoints = new List<Location>();
     _ghost = new List<Location>();
     _toTownWaypoints = new List<Location>();
     try
     {
         _doc = new XmlDocument();
         _doc.Load(_xmlFile);
     }
     catch (Exception e)
     {
         MessageBox.Show("Error in loaded profile: " + e);
     }
     try
     {
         foreach (XmlNode rootNode in _doc.ChildNodes)
         {
             foreach (XmlNode childNode in rootNode.ChildNodes)
             {
                 switch (childNode.Name)
                 {
                     case XmlStruct.Waypoint:
                         _waypoints.Add(GetCorrectLocation((childNode.InnerText)));
                         break;
                     case XmlStruct.ToTown:
                         _toTownWaypoints.Add(GetCorrectLocation((childNode.InnerText)));
                         break;
                     case XmlStruct.Ghost:
                         _ghost.Add(GetCorrectLocation((childNode.InnerText)));
                         break;
                 }
             }
         }
     }
     catch (Exception e)
     {
         MessageBox.Show("Error in converting profile " + e);
     }
     try
     {
         XmlNodeList roamDistance = _doc.GetElementsByTagName("RoamDistance");
         _roamDistance = Convert.ToInt32(roamDistance[0].ChildNodes[0].Value);
     }
     catch
     {
     }
     if (_roamDistance == 0.0f)
         _roamDistance = 35;
     try
     {
         XmlNodeList faction = _doc.GetElementsByTagName("Factions");
         string temp = faction[0].InnerText;
         string[] split = temp.Split(new[] {' '});
         Factions.AddRange(from s in split where s != "" select Convert.ToUInt32(s));
     }
     catch
     {
     }
     if (_waypoints.Count == 0)
     {
         MessageBox.Show("Profile should have more than 1 waypoint");
     }
     var pathProfile = new PathProfile();
     var subProfile = new SubProfile();
     for (int i = 0; i < _waypoints.Count; i++)
     {
         pathProfile.GetGraph.AddNodeNoConnection(_waypoints[i]);
         if (i == _waypoints.Count - 1)
         {
             pathProfile.GetGraph.AddEdge(_waypoints[i], _waypoints[0]);
         }
         else
         {
             pathProfile.GetGraph.AddNodeNoConnection(_waypoints[i + 1]);
             pathProfile.GetGraph.AddEdge(_waypoints[i], _waypoints[i + 1]);
         }
         subProfile.Spots.Add(new Location(_waypoints[i].X - 2, _waypoints[i].Y - 2, _waypoints[i].Z));
     }
     for (int i = 0; i < _ghost.Count; i++)
     {
         pathProfile.GetGraph.AddNodeNoConnection(_ghost[i]);
         if (i == _ghost.Count - 1)
         {
         }
         else
         {
             pathProfile.GetGraph.AddNodeNoConnection(_ghost[i + 1]);
             pathProfile.GetGraph.AddEdge(_ghost[i], _ghost[i + 1]);
         }
     }
     for (int i = 0; i < _toTownWaypoints.Count; i++)
     {
         pathProfile.GetGraph.AddNodeNoConnection(_toTownWaypoints[i]);
         if (i == _toTownWaypoints.Count - 1)
         {
         }
         else
         {
             pathProfile.GetGraph.AddNodeNoConnection(_toTownWaypoints[i + 1]);
             pathProfile.GetGraph.AddEdge(_toTownWaypoints[i], _toTownWaypoints[i + 1]);
         }
     }
     if (_ghost.Count != 0)
     {
         pathProfile.GetGraph.AddEdge(_ghost[0], GetListSortedAfterDistance(_ghost[0], _waypoints)[0]);
     }
     if (_toTownWaypoints.Count != 0)
     {
         pathProfile.GetGraph.AddEdge(_toTownWaypoints[0],
                                      GetListSortedAfterDistance(_toTownWaypoints[0], _waypoints)[0]);
     }
     subProfile.SpotRoamDistance = _roamDistance;
     foreach (uint faction in Factions)
     {
         subProfile.Factions.Add(faction);
     }
     subProfile.MobMaxLevel = 99;
     subProfile.MobMinLevel = 0;
     subProfile.PlayerMaxLevel = 99;
     subProfile.PlayerMinLevel = 0;
     subProfile.Order = true;
     subProfile.Name = "Converted profile";
     pathProfile.AddSubProfile(subProfile);
     pathProfile.SaveProfile(_folderSelected + "\\Converted.xml");
     MessageBox.Show("Convertion done");
 }
示例#9
0
        private void ButtonX3Click(object sender, EventArgs h)
        {
            if (string.IsNullOrEmpty(_folderSelected))
            {
                MessageBox.Show("Please select a folder.");
                return;
            }
            if (string.IsNullOrEmpty(_xmlFile))
            {
                MessageBox.Show("Please select a profile to convert.");
                return;
            }
            _waypoints       = new List <Location>();
            _ghost           = new List <Location>();
            _toTownWaypoints = new List <Location>();
            try
            {
                _doc = new XmlDocument();
                _doc.Load(_xmlFile);
            }
            catch (Exception e)
            {
                MessageBox.Show("Error in loaded profile: " + e);
            }
            try
            {
                foreach (XmlNode rootNode in _doc.ChildNodes)
                {
                    foreach (XmlNode childNode in rootNode.ChildNodes)
                    {
                        switch (childNode.Name)
                        {
                        case XmlStruct.Waypoint:
                            _waypoints.Add(GetCorrectLocation((childNode.InnerText)));
                            break;

                        case XmlStruct.ToTown:
                            _toTownWaypoints.Add(GetCorrectLocation((childNode.InnerText)));
                            break;

                        case XmlStruct.Ghost:
                            _ghost.Add(GetCorrectLocation((childNode.InnerText)));
                            break;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Error in converting profile " + e);
            }
            try
            {
                XmlNodeList roamDistance = _doc.GetElementsByTagName("RoamDistance");
                _roamDistance = Convert.ToInt32(roamDistance[0].ChildNodes[0].Value);
            }
            catch
            {
            }
            if (_roamDistance == 0.0f)
            {
                _roamDistance = 35;
            }
            try
            {
                XmlNodeList faction = _doc.GetElementsByTagName("Factions");
                string      temp    = faction[0].InnerText;
                string[]    split   = temp.Split(new[] { ' ' });
                Factions.AddRange(from s in split where s != "" select Convert.ToUInt32(s));
            }
            catch
            {
            }
            if (_waypoints.Count == 0)
            {
                MessageBox.Show("Profile should have more than 1 waypoint");
            }
            var pathProfile = new PathProfile();
            var subProfile  = new SubProfile();

            for (int i = 0; i < _waypoints.Count; i++)
            {
                pathProfile.GetGraph.AddNodeNoConnection(_waypoints[i]);
                if (i == _waypoints.Count - 1)
                {
                    pathProfile.GetGraph.AddEdge(_waypoints[i], _waypoints[0]);
                }
                else
                {
                    pathProfile.GetGraph.AddNodeNoConnection(_waypoints[i + 1]);
                    pathProfile.GetGraph.AddEdge(_waypoints[i], _waypoints[i + 1]);
                }
                subProfile.Spots.Add(new Location(_waypoints[i].X - 2, _waypoints[i].Y - 2, _waypoints[i].Z));
            }
            for (int i = 0; i < _ghost.Count; i++)
            {
                pathProfile.GetGraph.AddNodeNoConnection(_ghost[i]);
                if (i == _ghost.Count - 1)
                {
                }
                else
                {
                    pathProfile.GetGraph.AddNodeNoConnection(_ghost[i + 1]);
                    pathProfile.GetGraph.AddEdge(_ghost[i], _ghost[i + 1]);
                }
            }
            for (int i = 0; i < _toTownWaypoints.Count; i++)
            {
                pathProfile.GetGraph.AddNodeNoConnection(_toTownWaypoints[i]);
                if (i == _toTownWaypoints.Count - 1)
                {
                }
                else
                {
                    pathProfile.GetGraph.AddNodeNoConnection(_toTownWaypoints[i + 1]);
                    pathProfile.GetGraph.AddEdge(_toTownWaypoints[i], _toTownWaypoints[i + 1]);
                }
            }
            if (_ghost.Count != 0)
            {
                pathProfile.GetGraph.AddEdge(_ghost[0], GetListSortedAfterDistance(_ghost[0], _waypoints)[0]);
            }
            if (_toTownWaypoints.Count != 0)
            {
                pathProfile.GetGraph.AddEdge(_toTownWaypoints[0],
                                             GetListSortedAfterDistance(_toTownWaypoints[0], _waypoints)[0]);
            }
            subProfile.SpotRoamDistance = _roamDistance;
            foreach (uint faction in Factions)
            {
                subProfile.Factions.Add(faction);
            }
            subProfile.MobMaxLevel    = 99;
            subProfile.MobMinLevel    = 0;
            subProfile.PlayerMaxLevel = 99;
            subProfile.PlayerMinLevel = 0;
            subProfile.Order          = true;
            subProfile.Name           = "Converted profile";
            pathProfile.AddSubProfile(subProfile);
            pathProfile.SaveProfile(_folderSelected + "\\Converted.xml");
            MessageBox.Show("Convertion done");
        }