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(); } }
public bool CheckSkip() { if(!Core.Global.SkipWalk){return false;} Objects.Bot.Waypoint CurrentWaypoint = Core.Global.Waypoints[Core.WaypointLine]; Objects.Bot.Waypoint NextWaypoint; int NextWaypointIndex = 0; if (Core.WaypointLine == Core.Global.Waypoints.Count - 1) { NextWaypointIndex = 0; } else { NextWaypointIndex = Core.WaypointLine + 1; } NextWaypoint = Core.Global.Waypoints[NextWaypointIndex]; if (CurrentWaypoint.Location.DistanceTo(Core.client.PlayerLocation) <= Core.Global.SkipRange) { if (CurrentWaypoint.Script == "NextWaypoint()" && NextWaypoint.Location.Z == CurrentWaypoint.Location.Z && CurrentWaypoint.Type == Constants.WaypointType.Walk) { return true; } } return false ; }
private void downUseToolStripMenuItem_Click(object sender, EventArgs e) { Objects.Location l = Core.client.PlayerLocation; Objects.Bot.Waypoint w = new Objects.Bot.Waypoint(); w.Location = l; w.Type = Constants.WaypointType.DownUse; Core.Global.Waypoints.Add(w); }
private void listBox1_DoubleClick(object sender, EventArgs e) { if (listBox1.SelectedIndex > -1) { Objects.Bot.Waypoint w = Core.Global.Waypoints[listBox1.SelectedIndex]; Forms.Settings.AddWaypoint add = new Forms.Settings.AddWaypoint(w, listBox1.SelectedIndex); add.Show(); } }
private void westToolStripMenuItem1_Click(object sender, EventArgs e) { Objects.Location l = Core.client.PlayerLocation; Objects.Bot.Waypoint w = new Objects.Bot.Waypoint(); l.X -= 1; w.Location = l; w.Type = Constants.WaypointType.Machete; Core.Global.Waypoints.Add(w); }
public void Edit() { int x = Convert.ToInt32(TextBox1.Text); int y = Convert.ToInt32(TextBox2.Text); int z = Convert.ToInt32(TextBox3.Text); Objects.Location location = new Objects.Location(x, y, z); Objects.Bot.Waypoint w = new Objects.Bot.Waypoint(); w.Location = location; w.Type = GetWayPointType(); w.Script = FastColoredTextBox1.Text; w.Comment = TextBox4.Text; Core.Global.Waypoints[Editindex] = w; this.Close(); }
public void Add() { try { int x = Convert.ToInt32(TextBox1.Text); int y = Convert.ToInt32(TextBox2.Text); int z = Convert.ToInt32(TextBox3.Text); Objects.Location location = new Objects.Location(x, y, z); Objects.Bot.Waypoint w = new Objects.Bot.Waypoint(); w.Location = location; w.Type = GetWayPointType(); w.Script = FastColoredTextBox1.Text; w.Comment = TextBox4.Text; TextBox4.Text = ""; FastColoredTextBox1.Text = "NextWaypoint"; Core.Global.Waypoints.Add(w); } catch (Exception ex) { } }
private bool PerFormWaypoint(Objects.Bot.Waypoint w) { if(!Core.IsLoggedIn) { return false; } bool WaypointReached = false; if (Core.WaitForLoot > DateTime.Now) { if(Core.Looter.CorpseList.Count() > 0 && Core.Global.LootWhenAllIsDead == false) { return OpenCorpses(); } else { return false; } } else { if (Core.Looter.CorpseList.Count() > 0 && Core.Global.LootWhenAllIsDead == false) { return OpenCorpses(); } } if(Core.Attacker.TargetsAround > 0 || Core.client.Player.RedSquare > 0 || Core.client.MiniMap.IsWalking) { return false; } if(w.Location.Z != Core.client.PlayerLocation.Z) { NextWaypoint(); Core.SleepRandom(); return false; } if (Core.Global.LootWhenAllIsDead && Core.Looter.CorpseList.Count() > 0) { return OpenCorpses(); } if(Core.Global.Waypoints.Count() == 0) { return false; } switch(w.Type) { case Constants.WaypointType.Walk: if(Core.client.PlayerLocation == w.Location || Core.client.PlayerLocation.Z != w.Location.Z) { WaypointReached = true; break; } else { // Core.client.Player.GoTo = w.Location; PreformWalk(w.Location); break; } case Constants.WaypointType.UpUse: if(Core.client.PlayerLocation.Z <w.Location.Z) { WaypointReached = true; break; } else { if(Core.client.PlayerLocation == w.Location) { Tile t = Core.client.Map.GetTile(w.Location); foreach (Item i in t.Items) { if(Constants.TileList.UpUse.Contains((uint)i.Id)) { i.Use(); Core.SleepRandom(); WaypointReached = false; break; } } } else { // Core.client.Player.GoTo = w.Location; PreformWalk(w.Location); WaypointReached = false; break; } break; } case Constants.WaypointType.DownUse: if (Core.client.PlayerLocation.Z > w.Location.Z) { WaypointReached = true; break; } else { if (Core.client.PlayerLocation == w.Location) { Tile t = Core.client.Map.GetTile(w.Location); foreach (Item i in t.Items) { if (Constants.TileList.DownUse.Contains((uint)i.Id)) { i.Use(); Core.SleepRandom(); WaypointReached = false; break; } } } else { // Core.client.Player.GoTo = w.Location; PreformWalk(w.Location); WaypointReached = false; break; } break; } case Constants.WaypointType.Rope: if (Core.client.PlayerLocation.Z < w.Location.Z) { WaypointReached = true; break; } else { if(Core.client.PlayerLocation != w.Location && w.Location.IsAdjacentTo(Core.client.PlayerLocation) == false) { // Core.client.Player.GoTo = w.Location; PreformWalk(w.Location); WaypointReached = false; break; } else { // we must be on the spot Core.client.Inventory.UseItemOnTile(3003, Core.client.Map.GetTile(w.Location)); Core.SleepRandom(); WaypointReached = false; break; } } case Constants.WaypointType.Shovel: if (Core.client.PlayerLocation.Z > w.Location.Z) { WaypointReached = true; break; } else { if (Core.client.PlayerLocation != w.Location && w.Location.IsAdjacentTo(Core.client.PlayerLocation) == false) { // Core.client.Player.GoTo = w.Location; PreformWalk(w.Location); WaypointReached = false; break; } else { if(Core.client.PlayerLocation == w.Location) { List<Tile> tlist = Core.client.Map.GetTilesSameFloor().Where(t => t.Location.IsAdjacentTo(Core.client.PlayerLocation) && t.Location != Core.client.PlayerLocation && t.IsBlocking() ==false).ToList(); // Core.client.Player.GoTo = tlist[0].Location; PreformWalk(tlist[0].Location); WaypointReached = false; break; } else if (Core.client.PlayerLocation.IsAdjacentTo(w.Location)) { Tile t = Core.client.Map.GetTile(w.Location); Core.client.Inventory.UseItemOnTile(3457, t); Core.SleepRandom(); Core.client.Player.GoTo = w.Location; WaypointReached = false; break; } } } break; case Constants.WaypointType.Door: if(Core.client.PlayerLocation == w.Location) { WaypointReached = true; break; } else if(Core.client.PlayerLocation.IsAdjacentTo(w.Location) == false) { List<Tile> tiles = Core.client.Map.GetTilesSameFloor().Where(t => t.Location.IsAdjacentTo(w.Location)).ToList(); List<Tile> tList = tiles.Where(t => t.IsReachable()).ToList(); if(tList.Count() > 0) { //Core.client.Player.GoTo = tList[0].Location; PreformWalk( tList[0].Location); WaypointReached = false; break; } else { // Core.client.Player.GoTo = w.Location; PreformWalk(w.Location); WaypointReached = false; break; } } else if(Core.client.PlayerLocation.IsAdjacentTo(w.Location)) { Tile t = Core.client.Map.GetTile(w.Location); if(t.IsBlocking()) { foreach (Item i in Core.client.Map.GetTile(w.Location).Items) { if (i.ItemData.LensHelp == 1104)// dooor { i.Use(); Core.SleepRandom(); Core.client.Player.GoTo = w.Location; WaypointReached = false; break; } } } else { //Core.client.Player.GoTo = w.Location; PreformWalk(w.Location); WaypointReached = false; break; } } break; case Constants.WaypointType.Machete: if (Core.client.PlayerLocation == w.Location) { WaypointReached = true; break; } else if (Core.client.PlayerLocation.IsAdjacentTo(w.Location) == false) { List<Tile> tiles = Core.client.Map.GetTilesSameFloor().Where(t => t.Location.IsAdjacentTo(w.Location)).ToList(); List<Tile> tList = tiles.Where(t => t.IsReachable()).ToList(); if (tList.Count() > 0) { //Core.client.Player.GoTo = tList[0].Location; PreformWalk(tList[0].Location); WaypointReached = false; break; } else { // Core.client.Player.GoTo = w.Location; PreformWalk(w.Location); WaypointReached = false; break; } } else if (Core.client.PlayerLocation.IsAdjacentTo(w.Location)) { Tile t = Core.client.Map.GetTile(w.Location); if (t.IsBlocking()) { Item i = t.TopItem(); Packets.OutGoing.ItemUseOn.Send(Core.client, ItemLocation.FromHotkey().ToLocation(), 3308, 0, w.Location, (ushort)i.Id, i.Location.StackOrder); } else { //Core.client.Player.GoTo = w.Location; PreformWalk(w.Location); WaypointReached = false; break; } } break; } return WaypointReached; }