public void SetNewSpot(Location location) { SpotToHit = location; _path = PathProfile.FindShortsPath(ObjectManager.MyPlayer.Location, location); _currentWaypointIndex = 0; GrindingEngine.Navigator.SetDestination(location); }
public GrindingNavigation(PathProfile pathProfile) { PathProfile = pathProfile; SpotToHit = pathProfile.GetSubProfile().GetNextHotSpot(); _currentWaypointIndex = 0; _path = pathProfile.FindShortsPath(ObjectManager.MyPlayer.Location, SpotToHit); SetNextWaypoint(); }
public void UseNextNearestWaypoint() { _path = PathProfile.FindShortsPath(ObjectManager.MyPlayer.Location, SpotToHit); _currentWaypointIndex = 0; }
public void Reset() { SpotToHit = PathProfile.GetSubProfile().GetNextHotSpot(); _path = PathProfile.FindShortsPath(ObjectManager.MyPlayer.Location, SpotToHit); _currentWaypointIndex = 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"); }
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"); }